2

我想存储开始时间和结束时间并计算两次之间的总时间差。有时我会因为-1 min -24 sec这个问题而得到负时间......

如果我回显这段代码

date('Y-m-d h:m:s',1345810203);

我得到了答案2012-08-24 02:08:03,但我回显了这段代码

strtotime('2012-08-24 02:08:03');

我得到了答案1345766883

如果时间为13458101671345810187,请在 strtotime & date() 中给出正确的时间。

问题是什么 ?

4

1 回答 1

10

你有错误的格式。

mNumeric representation of a month, with leading zeros

iMinutes with leading zeros

使用以下格式:

'Y-m-d h:i:s'

参考: http: //php.net/manual/en/function.date.php

于 2012-08-24T12:38:01.400 回答