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

(tz) TimeZone.inDaylightTime() does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs

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

      Also repeatable on:
      1.5.0_08
      1.5.0_09
      1.6.*

      Regression: it works on 1.5.0_07 and earlier.

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]
      Linux expo 2.6.8-3-686 #1 Tue Dec 5 21:26:38 UTC 2006 i686 GNU/Linux



      A DESCRIPTION OF THE PROBLEM :
      Method TimeZone.inDaylightTime(Date) returns false for any argument.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the source code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Output:
      date: 2005-01-01; dst=false
      date: 2005-07-01; dst=true

      ACTUAL -
      date: 2005-01-01; dst=false
      date: 2005-07-01; dst=false


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.*;
      import java.util.*;

      public class tztest {
        private static final DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        private static final TimeZone tz = TimeZone.getTimeZone("EST");

        public static void main(String[] args) throws ParseException {
          check("2005-01-01");
          check("2005-07-01");
        }

        private static void check(String s) throws ParseException {
          Date date = format.parse(s);
          System.out.println("date: " + s + "; dst=" + tz.inDaylightTime(date));
        }
      }

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

            okutsu Masayoshi Okutsu
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: