Daylight savings problem
From: Svante Nicholas Arvedahl (svante_at_dataton.se)
Date: 10/20/03
- Next message: yair: "Re: byte to int casting question"
- Previous message: Lee Fesperman: "Re: Custom Class Loaders"
- Next in thread: Paul Lutus: "Re: Daylight savings problem"
- Reply: Paul Lutus: "Re: Daylight savings problem"
- Reply: Illya Kysil: "Re: Daylight savings problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 20 Oct 2003 08:22:34 GMT
Hi all!
I have the following problem with jdk 1.3.1 on Windows XP Home edition:
If I uncheck the box "Automatically adjust clock for daylight saving
changes" the time in my Java program is one hour ahead, as presented by
Date.toString for example, of the time presented in Windows XP. Further the
useDaylightSavings method of the default TimeZone (as returned by
TimeZone.getDefault()) always returns true, no matter if the win xp
"daylight saving" box is checked or not. I've tried setting XP up for both
the Stockholm time zone (gmt +1:00) and Central Time (GMT -6:00)
I have a simple test program:
Date date = new Date();
System.out.println(date);
System.out.println((TimeZone.getDefault().getDisplayName()));
System.out.println((java.util.TimeZone.getDefault().getRawOffset()));
System.out.println("Use dst: " +
java.util.TimeZone.getDefault().useDaylightTime());
System.out.println("In dst: " +
TimeZone.getDefault().inDaylightTime(date));
If I set xp up for central time 1:00 am and check the "daylight saving" box.
I get the following:
Mon Oct 20 01:00:25 CDT 2003
Central Standard Time
-21600000
Use dst: true
In dst: true
If I instead uncheck the "daylight saving" box and set the time to 1:00 am.
I get this:
Mon Oct 20 02:00:51 CDT 2003
Central Standard Time
-21600000
Use dst: true
In dst: true
I.e. one hour ahead and no way for me to compensate. Supplying a timezone at
the command line is not an option for me since I want my program to run
anywhere in the world with the time presented in the program in accordance
with the time presented in Windows.
Can anyone help me out on this one?
Thanks
Svante
- Next message: yair: "Re: byte to int casting question"
- Previous message: Lee Fesperman: "Re: Custom Class Loaders"
- Next in thread: Paul Lutus: "Re: Daylight savings problem"
- Reply: Paul Lutus: "Re: Daylight savings problem"
- Reply: Illya Kysil: "Re: Daylight savings problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|