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

(tz) TimeZone doesn't support Local Mean Time correctly

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.4.2_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
      Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

      java version "1.4.2_08"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
      Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      We have to convert date between java and ms excel. MS Excel uses 1900 year as a base one for its date fields. We tried to use Calendar object and saw strange things: If you create Calendar instance for 1900 year and try to add DATE_OF_YEAR, HOUR or other field to him, you will get wrong result. With other years 1901, 1899,etc it works fine. We can not change JDk version.

      I use English version of WinXP sp2 with additional Russian input locale
      . My TZ is GMT+2, DST is On.
      Locale.getDefault() returns en_US.
      If you could provide any additional tests I can run on my system I'd
      send a logs to you.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      public static void main(String[] args) {
      Calendar c = Calendar.getInstance();
      c.clear();
      c.set(Calendar.YEAR, 1900);
      System.out.println(c.getTime());
      c.add(Calendar.HOUR, 24);
      System.out.println(c.getTime());
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Mon Jan 01 00:00:00 EET 1900
      Mon Jan 02 00:00:00 EET 1900
      ACTUAL -
      Mon Jan 01 00:00:00 EET 1900
      Mon Jan 01 23:34:52 EET 1900


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Calendar;
      /**
       * @author ###@###.###
       */
      public class TestDates {

      public static void main(String[] args) {
      Calendar c = Calendar.getInstance();
      c.clear();
      c.set(Calendar.YEAR, 1900);
      System.out.println(c.getTime());
      c.add(Calendar.HOUR, 24);
      System.out.println(c.getTime());
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      not to use Calendar , convert to other base year but not to 1900

      Release Regression From : 1.4.2_07
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 2005-06-07 08:36:30 GMT

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                ndcosta Nelson Dcosta (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: