在SQL中更改UTC / GMT

时间:2016-01-08 05:44:49

标签: mysql sql time

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

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

1 个答案:

答案 0 :(得分:1)

您可以尝试这样:

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

参考manual

  

CONVERT_TZ()从给定的时区转换日期时间值dt   from_tz到to_tz给出的时区并返回结果   值。时区的规定如第10.6节“MySQL”中所述   服务器时区支持“。如果参数,此函数返回NULL   无效。