Can MySQL convert a stored UTC time to local timezone?

前端 未结 7 1317
被撕碎了的回忆
被撕碎了的回忆 2020-12-02 19:51

Can MySQL convert a stored UTC time to local time-zoned time directly in a normal select statement?

Let\'s say you have some data with a timestamp (UTC).



        
7条回答
  •  被撕碎了的回忆
    2020-12-02 20:11

    select convert_tz(now(),@@session.time_zone,'+03:00')
    

    For get the time only use:

    time(convert_tz(now(),@@session.time_zone,'+03:00'))
    

提交回复
热议问题