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

bugs in Date class, method java.util.Date.parse()

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

      The expression

      new java.util.Date("6/22/96 12:15PM").toString()

      throws an IllegalArgumentException. This is unfortunate.
      If a space is added:

      new java.util.Date("6/22/96 12:15 PM").toString()

      the result is "Tue Jul 23 00:15:00 EDT 1996"

      which has TWO mistakes in it: it has "Jul" instead of "Jun",
      and it has advanced 12:15 PM to be 12:15 AM on the following day!

      And if we try "AM":

      new java.util.Date("6/22/96 12:15 AM").toString()

      the result is "Mon Jul 22 12:15:00 EDT 1996"

      which is also twelve hours later than it is supposed to be.

            duke J. Duke
            mchansunw Mei Chan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: