Apr 23, 2003 #1 zyrag IS-IT--Management Joined Dec 4, 2002 Messages 252 Location PH i tried to find a function from the manual but it seems that there's none. Or, is there? how do you get the date difference between two dates? thanks,
i tried to find a function from the manual but it seems that there's none. Or, is there? how do you get the date difference between two dates? thanks,
Apr 24, 2003 #2 DRJ478 IS-IT--Management Joined Aug 10, 2001 Messages 2,264 Location US http://ca2.php.net/manual/en/function.date.php This snippet is offered on the above page: function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array("d"=>$d,"h"=>$h,"m"=>$m,"s"=>$s); } Upvote 0 Downvote
http://ca2.php.net/manual/en/function.date.php This snippet is offered on the above page: function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array("d"=>$d,"h"=>$h,"m"=>$m,"s"=>$s); }
Apr 24, 2003 #3 sleipnir214 Programmer Joined May 6, 2002 Messages 15,350 Location US I have a variant that returns years, months, and days between two dates. faq434-3493 Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL! Upvote 0 Downvote
I have a variant that returns years, months, and days between two dates. faq434-3493 Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!