gpt4 book ai didi

mysql - 在 SQL 中更改 UTC/GMT

转载 作者:行者123 更新时间:2023-11-29 11:47:33 24 4
gpt4 key购买 nike

Select dtCreated, fTotal, txtOrderStatus, txtOrderRef, txtPaymentMethod 
from order1
where txtOrderStatus != ('incomplete')
AND year(dtCreated)=2015 order by dtCreated ASC ;

我还需要将时区更改为 GMT +8,我该怎么做?

最佳答案

你可以这样尝试:

SELECT CONVERT_TZ(yourTime,'+00:00','+08:00');

请参阅manual :

CONVERT_TZ() converts a datetime value dt from the time zone given by from_tz to the time zone given by to_tz and returns the resulting value. Time zones are specified as described in Section 10.6, “MySQL Server Time Zone Support”. This function returns NULL if the arguments are invalid.

关于mysql - 在 SQL 中更改 UTC/GMT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34670280/

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