sofia403 Posted June 2, 2011 Share Posted June 2, 2011 Hi i was wondering if its possible to not display negative values or maybe there some other way to do this when date is calculated. in this case i have days, and the result brings "- 123" or "- 56" i just want it to show anything that's not negative. thanks. $start_ts = strtotime($row['Applied']); // when process started $end_ts = strtotime($row['Approval']); // when process finished $Approval = floor(($end_ts - $start_ts) / (60*60*24)); // days difference from start to finish Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 2, 2011 Share Posted June 2, 2011 $start_ts = strtotime($row['Applied']); // when process started $end_ts = strtotime($row['Approval']); // when process finished $date_diff = ($end_ts - $start_ts); $Approval = ($date_diff>0) ? floor($date_diff/ (60*60*24)) : ''; // days difference from start to finish Quote Link to comment Share on other sites More sharing options...
sofia403 Posted June 2, 2011 Author Share Posted June 2, 2011 Awesome! thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.