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

setTimeInMillis adding an extra hour as default

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.1
    • core-libs



      Name: jl125535 Date: 04/07/2003


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

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      The method Calendar.setTimeInMillis() when called is
      automatically adding 1 hour onto the stored time.

      I am using timezone GMT (London).

      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Write some code to use the setTimeInMillis method
      2. call setTimeInMillis with a value
      3. print out the set calendar time and note the time is
      wrong.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected the time to called to be set.
      Actual the time is an hour ahead.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Calendar;

      public class TestProblem {
        public static void main(String args[]) {
          GregorianCalendar cal = new GregorianCalendar();
          cal.clear();
          cal.setTimeInMillis(3600050);
          System.out.println("time="
              + new java.text.SimpleDateFormat( "kk:mm:ss" ).format( cal.getTime()));
        }
      }
      ---------- END SOURCE ----------
      (Review ID: 166905)
      ======================================================================

            okutsu Masayoshi Okutsu
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: