Daylight savings problem

From: Svante Nicholas Arvedahl (svante_at_dataton.se)
Date: 10/20/03


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



Relevant Pages

  • Re: Garmin 96C - Daylight saving time error!
    ... >>in March and October although DST commences on the first Sunday in April ... where the boundary between Eastern and Central timezones runs. ... Anyway it's your own fault if you can't set up Windows correctly for your ... Windows "knows" that daylight saving is not used. ...
    (sci.geo.satellite-nav)
  • Re: DST2007
    ... APAR PK24076 to resolve issue that affects Daylight Saving Time defaults ... You should anticipate more changes in DST and time zone rules ... Windows Update, Microsoft Update, Windows Server Update Services, and the ...
    (bit.listserv.ibm-main)
  • Re: Help with check time function
    ... using the UTC functions. ... The chage to/from DST normally occurs ... The clock for my mobile phone message system is in the same timezone ... Rather than daylight saving in summer, ...
    (comp.lang.javascript)
  • Re: error message 80073712 during windows update
    ... Vista SP1 is not installed in my computer. ... I am living in Sydney, now still in daylight saving. ... Windows version of the machine in question? ... However I still cannot install the update. ...
    (microsoft.public.windowsupdate)
  • Re: Universal time in 4DOS?
    ... :: Test for TZ variable with DST rules defined in Mm.n.d format ... DST is used below to denote local daylight saving time ... ISDST requires a complete time zone environment variable ...
    (comp.os.msdos.4dos)