2016-12-29 125 views

回答

1

@Pervez只是使用日期()函數的兩個變化像 您的日期時間格式如下嘗試

<?php 
    $time1 = strtotime('26:56:45'); 
    $time2 = strtotime('8:21:15'); 
    $difference = date("H:i", ($time1 - $time2)); 
    echo $difference; 
?> 

在這裏,你會得到你的差異想

0

這裏是回答..

例子

$time1 = strtotime('23:56'); // 2012-12-06 23:56 
$time2 = strtotime('00:21'); // 2012-12-06 00:21 
echo ($time1 - $time2)/60; 
0
$datetime1 = new DateTime("10:50:30"); 

$datetime2 = new DateTime("now"); 

$interval = $datetime1->diff($datetime2); 

echo $interval->h,":",$interval->i,":",$interval->s; 
相關問題