MySql - SELECT TimeStamp Column in UTC format

SELECT 
CONVERT_TZ(`timestamp_field`, @@session.time_zone, '+00:00') AS `utc_datetime` 
FROM `table_name`

I made a cheatsheet here: Should MySQL have its timezone set to UTC?

To avoid problems like the one mentioned by @spencer7593 with overlapping times, I recommend always storing dates in UTC


Besides changing the default timezone of the server, the timezone can also be adjusted per connection by executing this SQL statement:

SET time_zone = timezone;

Where timezone is the name of the timezone (see MySQL docs).

Alternatively, you can also convert a timestamp to a different timezone using the CONVERT_TZ function.

Tags:

Mysql

Utc