How to Convert UTC Date To Local time Zone in MySql Select Query

后端 未结 3 1078
夕颜
夕颜 2020-11-28 08:01

I am using this Where Condition in One Of my query with MySql Database.My Problem is that i have one displaytime column in my table but that table column shows the data in

3条回答
  •  孤城傲影
    2020-11-28 08:32

    In my case, where the timezones are not available on the server, this works great:

    SELECT CONVERT_TZ(`date_field`,'+00:00',@@global.time_zone) FROM `table`
    

    Note: global.time_zone uses the server timezone. You have to make sure, that it has the desired timezone!

提交回复
热议问题