Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: Daylight Saving Time Transition and GMT Time Zone Errors


View products that this article applies to.

Symptoms

Errors may occur in calculations involving Daylight Saving Time, or those involving conversions to and from Universal time ("UTC" or "Greenwich Mean Time").

Specifically, the starting and ending dates for Daylight Saving Time may be incorrect. Also, the GMT time zone is treated as though it enters Daylight Saving Time, when it should not. This affects the java.util.Date and java.util.Calendar classes, and methods of other classes that may depend on them.

↑ Back to the top


Cause

The java.util.TimeZone and java.util.SimpleTimeZone classes initialized the GMT time zone incorrectly, and improperly performed calculations determining Daylight Saving Time.

↑ Back to the top


Resolution

Install a version of the Microsoft virtual machine in which these problems have been fixed (see STATUS section below).

↑ Back to the top


Status

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in the Microsoft virtual machine, version 5.00.2829 and later, which can be found in the Microsoft SDK for Java version 3.0 and later. Please refer to the References section for more information.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Enter the following code into a file named DateBug.java, and compile it.
    import java.util.Date;
    
    public class DateBug
    {
        public static void main( String[] arg ) throws Exception
        {
            showDate( 98, 1, 1 );
            showDate( 98, 3, 28 );
            showDate( 98, 3, 29 );
            showDate( 98, 4, 4 );
            showDate( 98, 4, 5 );
            showDate( 98, 7, 21 );
            showDate( 98, 10, 24 );
            showDate( 98, 10, 25 );
            showDate( 98, 10, 30 );
            showDate( 98, 10, 31 );
            showDate( 98, 12, 20 );
    
            System.in.read();
        }
    
        static void showDate(int year, int month, int day) {
            Date d = new Date(year, month-1, day, 12, 0, 0);
            System.out.println(d + " local <=> GMT " + d.toGMTString());
        }
    }
    						
  2. Execute the program using the command "jview DateBug".
You will observe that between Friday, March 27, and Sunday, March 29, the GMT time is moved forward, as though it were in Daylight Saving Time. Also, (at least in the United States) you will observe that Daylight Savings Time for the local time zone begins a day early (Saturday, April 4) and ends several days late (it should end Sunday, October 26).

↑ Back to the top


References

For more information about Microsoft SDK for Java, visit the following Microsoft Web site: For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following pages on the Microsoft Technical Support site:

↑ Back to the top


Keywords: kbbug, kbfix, KB194768

↑ Back to the top

Article Info
Article ID : 194768
Revision : 7
Created on : 1/23/2007
Published on : 1/23/2007
Exists online : False
Views : 407