我在 stackoverflow 上搜索过帖子,找到了一些类似的帖子。但我认为这是不同的帖子。
我的 PHP 和 Mysql 服务器的时区都设置为“UTC”。
在我使用时间戳字段的表中,值为“2010-11-08 02:54:15”,我这样使用 sql:
SELECT id,
updated,
second( updated ) ,
unix_timestamp( updated )
FROM `transaction`
where id = 56
明白了:
id updated second unix
--------------------------------------------
56 2010-11-08 02:54:15 15 1289184879
然后我在 php 中使用它:
echo strtotime("2010-11-08 02:54:15");
明白了:
1289184855
不同的是24秒。
我在 http://www.unixtimestamp.com/index.php 上检查了这些时间戳 php 结果是正确的。那么mysql的unix_timestamp函数有bug吗? Mysql版本为:5.1.41
最佳答案
关于PHP strtotime 返回 Mysql UNIX_TIMESTAMP 的不同值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4121039/