Weblincs.co.uk is proud to...
As a part of our ongoing que...
WebLincs.co.uk is proud to a...
Operations performed on dates, particularly finding the difference, can be long and operationally tedious task. We have tried to make it easier for you by providing you with the following utility function to return the number of seconds difference between two dates. The function accepts standard MySQL DATE format strings.
function find_difference($start_date,$end_date) { list($date,$time) = explode(' ',$start_date); if($time == NULL) { $time = '00:00:00'; } $startdate = explode("-",$date); $starttime = explode(":",$time); list($date,$time) = explode(' ',$end_date); if($time == NULL) { $time = '00:00:00'; } $enddate = explode("-",$date); $endtime = explode(":",$time); $secons_dif = mktime($endtime[0], $endtime[1], $endtime[2], $enddate[1], $enddate[2], $enddate[0]) - mktime($starttime[0], $starttime[1], $starttime[2], $startdate[1], $startdate[2], $startdate[0]); return $secons_dif; }
Back to Web Development Articles.