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 Link to comment https://forums.phpfreaks.com/topic/238227-date-calculation/ 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 Link to comment https://forums.phpfreaks.com/topic/238227-date-calculation/#findComment-1224202 Share on other sites More sharing options...
sofia403 Posted June 2, 2011 Author Share Posted June 2, 2011 Awesome! thank you Link to comment https://forums.phpfreaks.com/topic/238227-date-calculation/#findComment-1224211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.