我在添加时间时遇到问题,这是不正确的。示例:00:00 + 00:35 = 11:13
它应该是 00:35 而不是 11:13
这是我上面的代码:
echo date('H:i',$total).' + '.$telat2.' = ';
if($telat2 == '00:00'){
$total = $total;}
else{
$total = ($total) + strtotime($telat2);}
echo date('H:i',$total).' ';
我希望这里的每个人都可以帮助我..
提前致谢..
更新 1
我刚刚得到了正确的代码!这是代码:
$total_unix = strtotime(date('Y-m-d').' '.$total.':00');
$telat2_unix = strtotime(date('Y-m-d').' '.$telat2.':00');
$begin_day_unix = strtotime(date('Y-m-d').' 00:00:00');
$total = date('H:i', ($total_unix + ($telat2_unix - $begin_day_unix)));
我想知道这怎么会发生?
有人可以向我解释一下吗?