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');
Previous
How to Group by TimeFrom MySQL query to chart to Slack in seconds
Get to answers faster, together, with PopSQL and MySQL