gpt4 book ai didi

PHP strtotime 返回 Mysql UNIX_TIMESTAMP 的不同值

转载 作者:可可西里 更新时间:2023-11-01 07:33:43 25 4
gpt4 key购买 nike

我在 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

最佳答案

确认为bug,5.1.44修复

参见 http://bugs.mysql.com/bug.php?id=51918有关详细信息,错误发布者已准确找到此问题。

你别无选择,只能通过升级来避免这种情况。

关于PHP strtotime 返回 Mysql UNIX_TIMESTAMP 的不同值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4121039/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com