Lebowtech Blog

Convert TimeZones in Mysql Preserving DST

| Comments

When converting time zones with MySql you should use the method CONVERT_TZ so that it will automatically take into account DST ( Daylight savings time / שעון קיץ )

convert date preserving timezone
SELECT CONVERT_TZ('2013-03-29 12:00','America/New_York','Asia/Jerusalem');

This will convert a date in New York to our local time.

If you do not use this method and just subtract 7 hours from the time, you will have errors when we switch to and from DST.