Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4054053

toGMTString() wrongly applies daylight saving in JDK1.1 only

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1
    • core-libs
    • None
    • x86
    • windows_95



      Name: mc57594 Date: 05/22/97


      The following code, which runs correctly under JDK 1.0.2 and
      current web browsers (Netscape 3.01 and Microsoft IE 3),
      shows that the JDK1.1 implementation of Date.toGMTString()
      incorrectly applies the adjustment for daylight saving time,
      rather than leaving GMT as GMT.

      This may also affect java.text.SimpleDateFormat

      // This is JDK 1.0.2 code, but I believe the problem with JDK 1.1
      // executing it is due to the java.text.SimpleDateFormat class

      import java.util.Date;
      import java.applet.Applet;

      public class TestGMT extends Applet {
          public void init () {
              main(new String[0]);
          }

          public static void main (String[] args) {
              // First one is OK under all systems (JDK 1.0.2 and JDK1.1 and
              // Netscape 3.0.1 and Microsoft Explorer 3)
              long noon28Mar1997 = 859550400000L;
              System.out.println ((new Date (noon28Mar1997)).toGMTString());

              // This one prints as 13:00 under JDK 1.1, 12:00 on all others
              long noon30Mar1997 = noon28Mar1997 + 2 * 24 * 3600 * 1000;
              System.out.println ((new Date (noon30Mar1997)).toGMTString());
          }
      }

      company - R-cube Systems Limited , email - ###@###.###
      ======================================================================

            ssenthilsunw Shanmugam Senthil (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: