Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Are the "Etc/GMT-8" and "GMT-8" timezones equal?

807591Mar 20 2008
Hi,

I was wondering what's the difference between the timezones "Etc/GMT-8" and "GMT-8".
They have different display names, and different raw offsets, but Calendars using both zones have the same date:
java.util.TimeZone zone = java.util.TimeZone.getTimeZone("Etc/GMT-8");
System.out.println(zone.getDisplayName());
java.util.TimeZone zone1 = java.util.TimeZone.getTimeZone("GMT-8");
System.out.println(zone1.getDisplayName());
System.out.println( zone.getRawOffset() );
System.out.println( zone1.getRawOffset() );
Calendar c = Calendar.getInstance( zone );
System.out.println( c.getTime() );
Calendar c1 = Calendar.getInstance( zone1 );
System.out.println( c1.getTime() );
It's a pity the TimeZone does not override the equals method. That probably would have been the quickest answer to my question.

Thanks,
Oded
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 17 2008
Added on Mar 20 2008
0 comments
337 views