我正在计算两个日期之间的月、日、小时和分钟,我已经成功地计算出月、日和分钟,但我不能让它计算出分钟,下面是我的代码.
<?php
$date1 = "2012-07-01 00:00:00";
$date2 = "2012-09-30 00:00:00";
$diff = abs(strtotime($date2) - strtotime($date1));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
$minutes = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24) / (60*60*24) / (60*60));
printf("%d years, %d months, %d days, %d minutes\n", $years, $months, $days, $minutes);
?>