0
我試圖計算我正在JS onChange事件中工作的時間表,下面的工作,但它不會在午夜工作,例如23:00 - 01:00返回22而不是2或者說2.00,因爲我希望它報告2位小數。PHP時間表計算過去24小時
$startm = date_create({mS}); //create a php datetime object
$finishm = date_create({mF});
$t_diff = date_diff($startm, $finishm); //calculate the difference
{mT} = $t_diff->h + round($t_diff->i/60,2) + {mOt} + {mOt2} /24; //add everything up
形式具有以下字段
Start Tme = mS - 24hr time
Finish Time = mF - 24hr time
Overtime = mOt - int
Overtime 2 = mOt2 - int
Total = mT - int
如果第二次比第一次小,在做差異前添加一個日期 –