note 22461 deleted from function.date by victor

From: Date: Sat, 24 Aug 2002 15:52:36 +0000
Subject: note 22461 deleted from function.date by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35526@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); }

« previous php.notes (#35526) next »