user1050619
user1050619

Reputation: 20886

convert GMT time to EST

My sql server is located in GMT and I need to get the EST equivalent tz.

Somehow the EST is wrong.

select now(),convert_tz(now(),'GMT','EST'),convert_tz(now(),'GMT','EST') - interval 10 minute

The EST time should be 20:30 and not 19:30

Here is my results -

enter image description here

Upvotes: 2

Views: 5148

Answers (1)

jhanschoo
jhanschoo

Reputation: 1346

As @ceejayoz mentioned, the timezones of locations change depending on daylight savings observation. In addition, it's more proper to call it UTC rather than GMT, as when you call it GMT, it connotes that your servers are tune to some local time, say, London time, and that your server's time will switch to some other time, say BST, when daylight savings is observed.

Assuming, as I presume you are trying to communicate, that your servers are set to UTC time, never observing daylight savings, and that you want to translate it to the time observed by most Eastern US cities, a solution would be

SELECT NOW(),
  CONVERT_TZ(NOW(), 'UTC', 'America/New_York'),
  CONVERT_TZ(NOW(), 'UTC', 'America/New_York') - INTERVAL 10 MINUTE;

Upvotes: 1

Related Questions