我想知道如何減去兩個變量在PHP如何在PHP中減去分鐘數?
例如代表分鐘,我有2分鐘變量
$minutes1 = 20;
$minutes2 = 45;
$totalMinutes = $minutes1 -$minutes2;
//output should be 35 as $totalMinutes
一個例子是
$time1 = "2:20";
$time2 = "3:45";
$finalTime = $time2 - $time1
//final time = 1:25
我只關心在分鐘而不是小時
如何 - 20分鐘後45分鐘= 35分鐘呢? –
@MagnusEriksson前一小時35分鐘。像2:20 - 45分鐘= 1:35 –
https://stackoverflow.com/questions/12969413/how-to-subtract-two-numeric-strings –