开发者

Why is strtotime($lastmoment) bigger than time()?

The following code

 ech开发者_开发问答o $lastmoment."<br/>";
echo time();
echo "<br/>";
echo strtotime($lastmoment);

outputs:

2009-12-15 17:40:53 1260876829 1260898853

What's wrong? $lastment is a past time stamp in MySQL, why is strtotime($lastmoment) bigger than time()?


If your MySQL server is a different machine, or if the timestamp in $lastmoment was set from a different machine, you could be seeing clock drift. Check the system clocks on the various machines, and see if they agree.


Because the time() function was may be executed some milliseconds before the $lastmoment.

EDIT: Adding the comment to my thoughts, it might me that, the convert of strtotime() might have failed. Or the date value from the database contains a value e.g. days which the date() does not have. Be sure, that you compare 2 datevalues of the same format.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜