2010-08-17 63 views
0

我认为strtotime()会将“字符串”转换为时间戳。如果我加上时间,它可以正常工作,但如果我尝试减去,它不会。有谁知道解决方法?strtotime(“ - 5小时”)不工作?

在此先感谢。

+0

不特定于PHP5,请正确标记。 http://php.net/manual/en/function.strtotime.php – TheLQ 2010-08-17 21:17:18

+2

它是如何工作的? 'var_dump(strtotime(“ - 5 hours”))'为我输出一个合适的,非错误的值。 – 2010-08-17 21:19:57

+1

你是否试过“-05:00”让它知道它的小时而不是“小时” – DevelopingChris 2010-08-17 21:22:37

回答

3

它似乎好工作对我来说...

echo strtotime("-5 hours"); 

结果:

1282061972 
+0

同上。 (你打败了我...) – Stephen 2010-08-17 21:21:53

+0

确认为PHP 5.3.27。 – crmpicco 2014-02-19 13:51:09