note 69833 deleted from function.date by bobby

From: Date: Fri, 22 Sep 2006 14:37:51 +0000
Subject: note 69833 deleted from function.date by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117428@lists.php.net to get a copy of this message
Note Submitter: sammy DOT fischer AT gmail DOT c0m ---- the example from michiel at mb-it dot nl, but for mySQL DATETIME fields : (this one returns the number of minutes between two entries) function get_date_difference($begin, $end) { $date1=explode( "-", $begin, 10); $time1=explode(":",substr($begin, 11)); $date2=explode( "-", $end, 10); $time2=explode(":",substr($end, 11)); // need to split the return line for PHP.NET $t1=mktime($time1[0],$time1[1],$time1[2],$day1[1],$day1[2],$day1[0]); $t2=mktime($time2[0],$time2[1],$time2[2],$day2[1],$day2[2],$day2[0]); return ceil(($t2-$t1)/60); } $begin = "2006/09/22 10:23:00"; $end = "2006/09/22 10:26:30"; get_date_difference($begin,$end);

« previous php.notes (#117428) next »