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!

default timezone is wrong!

807589May 26 2004 — edited Aug 24 2008
On one computer in our development shop, java's notion of time is one hour behind. It seems that Java gets the wrong default timezone for that machine, and I can't for the life of me figure out why.

All machines are running java 1.4.2_03 on WinXP SP1 with all latest updates as of 5/25/04. In the Windows Date/Time control panel on all machines, timezone is set to "(GMT-0:800) Pacific Time (US & Canada); Tijuana" and the "Automatically Adjust for Daylight Savings Time" box is checked. It is May May 26, so daylight savings time is in effect. The Windows clock in the lower right corner reads the same time on all machines.

Running the code:
TimeZone tz = TimeZone.getDefault();
System.out.println("the default timezone is " + tz.getDisplayName(true, TimeZone.LONG));
System.out.println("the default timezone ID is " + tz.getID());
System.out.println("useDaylightTime = " + tz.useDaylightTime());
On the "bad" machine produces:
the default timezone is GMT-08:00
the default timezone ID is GMT-08:00
useDaylightTime = false
All other machines produce
the default timezone is Pacific Daylight Time
the default timezone ID is America/Los_Angeles
useDaylightTime = true
Why is the timezone on the "bad" machine "GMT-08:00" instead of "America/LosAngeles"?

(I've also verified that the default Locale on all machines is the same).

Any help would be appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2008
Added on May 26 2004
49 comments
3,364 views