gpt4 book ai didi

mysql - 在 MySQL 中将 UTC 格式的日期时间转换为 GMT+7

转载 作者:行者123 更新时间:2023-11-29 02:40:41 26 4
gpt4 key购买 nike

我在 Y-m-d H:i:s UTC 格式的 MySQL 表中有一个日期时间列:

SELECT `transaction_time` FROM `transaction` LIMIT 1;
//2018-10-12 09:36:12

以上将显示我已经以 UTC 格式保存的数据库记录,如何以 GMT+7 格式显示它?

最佳答案

您可以使用 CONVERT_TZ() 方法。

Select CONVERT_TZ(`transaction_time`,'+00:00','+07:00') from `transaction` LIMIT 1;

Refer to this link

关于mysql - 在 MySQL 中将 UTC 格式的日期时间转换为 GMT+7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52771413/

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