gpt4 book ai didi

Mysql 时间戳 : output UTC time instead of local server time?

转载 作者:行者123 更新时间:2023-11-30 23:27:27 25 4
gpt4 key购买 nike

我正在创建必须根据用户本地时间显示时间的软件。用户可以来自世界各地。

根据我一直在阅读的内容,Mysql 以 UTC 格式存储时间戳,然后将其转换为服务器时区。

无论如何我可以输出原始 UTC 时间的时间戳,而不是让它自动转换为服务器的本地时间?

我想这样做而不必弄乱 mysql 的时区设置,因为我的软件将在共享主机中使用,我不知道我是否可以控制这些设置。

最佳答案

https://stackoverflow.com/a/12290486/110933

SELECT UNIX_TIMESTAMP(<your_datetime_col>)...

关于Mysql 时间戳 : output UTC time instead of local server time?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12532594/

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