phpで日付の差を計算するプログラム

phpコード:
date_default_timezone_set(“Asia/Calcutta");

function dt_differ($start, $end){
$start = date(“G:i:s:m:d:Y", strtotime($start));
$date1=explode(“:", $start);

$end = date(“G:i:s:m:d:Y", strtotime($end));
$date2=explode(“:", $end);

$starttime = mktime(date($date1[0]),date($date1[1]),date($date1[2]),
date($date1[3]),date($date1[4]),date($date1[5]));
$endtime = mktime(date($date2[0]),date($date2[1]),date($date2[2]),
date($date2[3]),date($date2[4]),date($date2[5]));

$seconds_dif = $starttime-$endtime;

return $seconds_dif;
}

Development

Posted by arkgame