Start Date: 2015-11-15 11:40:44pm
End Date: 2015-11-22 10:50:88am
现在我需要找到以下形式这两者之间的区别的两个日期时间:
0 years, 0 months, 7 days, 22 hours, 44 mints, 35 sec
我怎样才能做到这一点在PHP?
我已经尝试:
$strStart = date('Y-m-d h:i:s', time() - 3600);
$strEnd = '2015-11-22 02:45:25';
$dteStart = new DateTime($strStart);
$dteEnd = new DateTime($strEnd);
$dteDiff = $dteStart->diff($dteEnd);
echo $dteDiff->format("%H:%I:%S");
输出:22:53:58
输出不能完全显示。
你尝试过什么?至少尝试一些php的日期时间函数,如果失败了,我们可以帮助你解决失败的代码。 – Terradon