Can MySQL convert a stored UTC time to local timezone?

前端 未结 7 1304
被撕碎了的回忆
被撕碎了的回忆 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:10

    For those unable to configure the mysql environment (e.g. due to lack of SUPER access) to use human-friendly timezone names like "America/Denver" or "GMT" you can also use the function with numeric offsets like this:

    CONVERT_TZ(date,'+00:00','-07:00')
    

提交回复
热议问题