Been playing around with Joda timezones and found the following which seemed odd.
I ran the following code
DateTimeZone gmt = DateTimeZone.forID( "Etc/GMT" );
DateTimeZone gmtPlusOne = DateTimeZone.forID( "Etc/GMT+1" );
DateTimeZone gmtMinusOne = DateTimeZone.forID( "Etc/GMT-1" );
System.out.println( new DateTime( gmt ).toString() );
System.out.println( new DateTime( gmtPlusOne ).toString() );
System.out.println( new DateTime( gmtMinusOne ).toString() );
And got the following output
2011-10-24T13:00:12.890Z
2011-10-24T12:00:12.937-01:00
2011-10-24T14:00:12.937+01:00
I was a bit suprised to see "gmtPlusOne" coming out as one hour behind with -01:00 and the reverse for "gmtMinusOne". Can someone explain why these come out like this as I would have expected the opposite.
This documentation explains the reason for this not so intuitive behavior. It says Etc/GMT+1
has a standard offset of -1:00
and Etc/GMT-1
has a standard offset of +1:00
. This reversal of offset holds for any Etc/GMT+n
.
From wiki
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 what most people expect. In this style, 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/east of GMT.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With