我愿意
strtotime("2008-09-04")
其中 09 是月份,04 是日期,我得到的结果是:
1220500800
2008 年 9 月 4 日星期四 04:00:00 GMT。这 4 个小时是从哪里来的?我应该从 strtotime 获取 1220486400
而不是 1220500800
。
最佳答案
您可以使用函数 date_default_timezone_set('UTC');
全局设置时区,或者您可以在调用 strtotime()
函数时只在本地设置时区,例如:
echo strtotime("2008-09-04 +0000"); # 1220486400
关于Php strtotime 返回错误的时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22236510/