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

SimpleDateFormat always parses 2 digit dates relative to 1900

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.4
    • CPU:
      generic
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description

      SimpleDateFormat always parses 2 digit dates relative to 1900. This means a date like 5/4/02 would be May 4 1902 rather than May 4, 2002. This is not likely to be what the user wants.

      <jimholl 11/10/97>
      I ran some tests against jdk1.1.4:

      10/15/99 parsed to: Fri Oct 15 00:00:00 PDT 1999
      10/15/00 parsed to: Sun Oct 15 00:00:00 PDT 2000
      10/15/17 parsed to: Sun Oct 15 00:00:00 PDT 2017
      10/15/18 parsed to: Tue Oct 15 00:00:00 PDT 1918
      10/15/68 parsed to: Tue Oct 15 00:00:00 PDT 1968
      10/15/69 parsed to: Wed Oct 15 00:00:00 PDT 1969

      The fourth and fifth results fail to comply with the SunSoft y2000
      requirements. It seems that 2017/1918 is used as the cut-off for
      2-digit dates when 2038/1939 is required.

      What is the policy in use? Can it change?

      john.evans@Eng 1997-11-11
      -------------------------
      Actually, the Y2000 compliance dates are as follows:
      00-68 --> 20xx
      69-99 --> 19xx

        Attachments

          Activity

            People

            Assignee:
            busersunw Btplusnull User (Inactive)
            Reporter:
            bcbeck Brian Beck (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: