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

DateFormat maps two DIFFERENT times into the same numeric

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.8
    • core-libs
    • x86
    • windows_nt



      Name: vi73552 Date: 05/03/99


      This problem appears to be the mapping between "numeric" to "String Liturals" NOT being ONE-TO-ONE.
      (Well, that is my guess and what it appears to be!)

      The easiest way to reproduce this is by using the one of the "DEMO" codes download from Sun for JDK 1.1.8 (also happened on 1.1.7b) under the dir say "D:\jdk1.1.8\demo\i18n\DateTimeFormat\example1.html"

      1. Load the applet
      (With all setting being default, well for me at least! will be:

      [Localized Pattern] = unckecked
      [Validation Mode] = unckecked
      [City] = Washington
      [Date Fields] = Year
      [Roll] = true
      [Locale] = English (United States)
      [Date and Time Format] = true
      [Date Style] = Full
      [Time Style] = Full

      2. Set the [Pattern] field to "yyyy/DDD HH:mm:ss"

      3. Set the [New Date] field to "1999/094 02:xx:xx" (where "x" can be any number say "0" zeros)
      (let use "1999/094 02:22:55")

      4. Pay attention to the [Millis] field (write it down if you want)
      (if you use my value, you'll get
      923206975000)

      5. Now set the [New Date] field to "1999/094 01:xx:xx"
      (Basically just change the hour from "02" to "01")

      6. Observe what the [Millis] field give you!!
      (Yip! the Same exact numeric value. When in fact, it shouldn't!!!)

      (Note: also try these values:
      ...
      1995/092 02:xx:xx
      1996/098 02:xx:xx
      1997/096 02:xx:xx
      1998/095 02:xx:xx
      1999/094 02:xx:xx
      2000/093 02:xx:xx
      2001/091 02:xx:xx
      2002/097 02:xx:xx
      2003/096 02:xx:xx
      2004/095 02:xx:xx
      ...
      )

      I'm using this pattern (yyyy/DDD HH:mm:ss) on my Java application and the same behavior is observed.

      This means given a year, there's at least one day, one hour your time will act funky!!
      Because your hours "01" and "02" get mapped to the SAME numeric value.

      Please! Please! fix this!! :(
      (Review ID: 57351)
      ======================================================================

            okutsu Masayoshi Okutsu
            vasya Vassili Igouchkine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: