Today I spent multiple hours trying to debug a timezone issue in a codebase. The timezone I was testing with was Etc/GMT+4, which I had assumed was four hours ahead of GMT. Turns out, it’s actually 4 hours behind GMT 🤦♂️
GMT+4 would add 4 hours to Greenwich Mean Time though? That’s GET (Georgia Standard Time), so 10am (1000) GMT would be 2pm (1400) GET.
GMT-4 would be EDT (Eastern Daylight Time), so that 10am (1000) GMT would be 6am (0600) EDT. Also, Georgia the state is in that time zone funny enough haha
(For the most part. Timezones are really really complicated and you should probably just look up the offset for the specific city/region you want Everytime and use some other package for time stuff lol)
The special area of “Etc” is used for some administrative zones, particularly for “Etc/UTC” which represents Coordinated Universal Time. In order to conform with the POSIX style, those zone names beginning with “Etc/GMT” have their sign reversed from the standard ISO 8601 convention. In the “Etc” area, zones west of GMT have a positive sign and those east have a negative sign in their name (e.g “Etc/GMT-14” is 14 hours ahead of GMT).
Today I spent multiple hours trying to debug a timezone issue in a codebase. The timezone I was testing with was
Etc/GMT+4, which I had assumed was four hours ahead of GMT. Turns out, it’s actually 4 hours behind GMT 🤦♂️I cannot express how much I hate that timezones aren’t flipped.
12:00+02:00should be equal to14:00+00:00like a math equation!GMT+4would add 4 hours to Greenwich Mean Time though? That’sGET (Georgia Standard Time), so 10am (1000) GMT would be 2pm (1400) GET.GMT-4would beEDT (Eastern Daylight Time), so that 10am (1000) GMT would be 6am (0600) EDT. Also, Georgia the state is in that time zone funny enough haha(For the most part. Timezones are really really complicated and you should probably just look up the offset for the specific city/region you want Everytime and use some other package for time stuff lol)
Yeah, you would’ve thought it would work that way. Regrettably, the standard timezone code of
Etc/GMT+4is actually GMT-4. Wikipediahttps://en.wikipedia.org/wiki/Tz_database#Area