Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个代码,他计算日期差异,到目前为止它一直很好,但我有问题,我想从较低的数字中减去高数字并在负数上显示值,这个代码会自动找到哪个数字更高我不想要那个。
$to_time = strtotime("2012-10-25 10:42:00"); $from_time = strtotime("2012-10-26 10:21:00"); echo round(abs($to_time - $from_time) / 60,2). " minute";
尝试
echo round(($to_time - $from_time) / 60,2). " minute";
尝试这个
$to_time = strtotime("2012-10-25 10:42:00"); $from_time = strtotime("2012-10-26 10:21:00"); echo round(($to_time - $from_time)/60,2). " minute";