GMT/UTC standards reversed in timezone standards (and PHP, and wordpress, and Unix/Posix)
Well, software never stops surprising me.
Working on a new project which involves PHP and timezones, I obviously needed to use these PHP supported timezone standards. No problem when I set a timezone to a specific standard location (i.e. ‘America/New_York’), but when using the non-recommended GMT standards, the resulting time was reversed. So, by selecting GMT-5, the America East Coast time, the clock gave me GMT+5 time, something like the time in Uzbekistan (Asia) .
In other words, time ahead of Europe/Greenwich, not behind as if GMT standards signs were reversed.
Now, after double checking the code and some , I found the following:
directly from wikipedia’s Timezone aka TZ database page:
“Additionally a special area of Etc is used for some administrative zones (…). In order to conform with the POSIX style, those zones beginning with “Etc/GMT” have their sign reversed from what most people expect. In this style, zones west of GMT have a positive sign and those east have a negative sign.”
So, yes GMT (aka UTC) standards are reversed in the timezone standard database. I do not know how the “POSIX style” might justify such a confusion, maybe a nerd “stumbling upon” can write POSIX’s very good reasons in my comments
Not for nothing, the php.net site recommends NOT to use the Etc/GMT standards and wordpress administration page, in Setting -> General -> Timezone field doesn’t show the resulting “local time” by selecting UTC+10 or UTC-5 (unlike what happens by selecting a geographical timezone location).
What I did in my drop-down menu was reversing the signs between the values in the <option> tags and the displayed strings, and added a lengthy comment in the source code.
Well, I hope this helps someone else struggling with the same issue, at least.
Wonder if these nerdy posts are related to my job, well, the answer is no. As a good friend once told me, "one never heals from programming!". It must be true in my case....
TrackBack URL for this entry: