开发者

strtotime("-5 hours") not working?

I thought strtotime() would convert a "string" into a timestamp. If I add on to the time, it works fine, but if I try to subtract, it doesn't. D开发者_运维知识库oes anyone know a workaround?

Thanks in advance.


It seems to work fine for me...

echo strtotime("-5 hours");

Result:

1282061972


I recommend reading Derick Rethans's excellent guide on Date and Time, http://derickrethans.nl/talks/time-zendcon9.pdf, explanatory slides start at slide 16.

He's the author of PHP's date and time functions and recommends that you use the DateTime classes if possible.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜