Introducing PopSQL + dbt. The first SQL editor with built-in dbt support.Read more →

How to Convert UTC to Local Time Zone in MySQL

MySQL does not store time zone data when storing timestamps. It also uses the host server time as basis for generating the output of NOW();

To convert a timestamp from one time zone to another, you can use the CONVERT_TZ function:

-- using named time zones
SELECT CONVERT_TZ('2018-01-01 12:00:00','UTC','MET');

-- using offset time zones
SELECT CONVERT_TZ('2018-01-01 12:00:00','+00:00','+10:00');

Ready for a modern SQL editor?