note 22461 added to function.date

From: Date: Wed, 19 Jun 2002 05:13:12 +0000
Subject: note 22461 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-31999@lists.php.net to get a copy of this message
I like m0sh3NO@SPAMhotmail.com's date_diff function but I changed it just a little to accept timestamps instead of strings and also to take the absolute value of the dates so I wouldn't get negatives. Here's how I modified it: function date_diff($date1, $date2) { $s = abs($date2-$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); } -- http://www.php.net/manual/en/function.date.php http://master.php.net/manage/user-notes.php?action=edit+22461 http://master.php.net/manage/user-notes.php?action=delete+22461 http://master.php.net/manage/user-notes.php?action=reject+22461

« previous php.notes (#31999) next »