gpt4 book ai didi

php - Linux 时间戳到 PHP

转载 作者:可可西里 更新时间:2023-11-01 13:50:52 25 4
gpt4 key购买 nike

我有以下时间戳:

1342259667654

当用 http://www.epochconverter.com/ 转换时给出:

Assuming that this timestamp is in milliseconds:
GMT: Sat, 14 Jul 2012 09:54:27 GMT
Your time zone: 14. juli 2012 11:54:27 GMT+2

这是正确的时间,但使用时:

echo date("Y-m-d H:i:s", 1342259667654);

我得到以下日期:

1904-07-24 10:22:47

我如何使用 PHP 获取此时间戳之外的确切日期?

最佳答案

您的时间戳需要除以 1000:

echo date("Y-m-d H:i:s", 1342259667654/1000);

关于php - Linux 时间戳到 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11486957/

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