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

In versions before 1.1.6, DateFormat.parse considers 022900 to be 030100.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 1.1.6
    • 1.1.5
    • core-libs
    • None
    • 1.1.6
    • sparc
    • solaris_2.5.1
    • Verified

      There was a bug in DateFormat.parse that was fixed in 1.1.6, and
      stays fixed in later releases. If you try to search our bug database
      for this bug, all you find is chaos.

      I am filing this bug retroactively to clarify things. Here is the
      program that clearly demonstrates what is wrong with 1.1.5. It also
      shows that things have been fixed in 1.1.6.

      ----
      import java.util.Date;
      import java.text.SimpleDateFormat;

      public class ParseProblem_022900 {
          public static void main(String[] args) throws Exception {
      System.out.println(System.getProperty("java.version"));
      SimpleDateFormat format = new SimpleDateFormat("MM/dd/yy");
      String input = "02/29/00";
      Date date = format.parse(input);
      System.out.println("input = " + input +
      ", format = " + format.toPattern() +
      ", output = " + date);
          }
      }
      -----

      $ $ulj/jdk1.1.5/solaris/bin/java ParseProblem_022900
      1.1.5
      input = 02/29/00, format = MM/dd/yy, output = Wed Mar 01 00:00:00 PST 2000

      $ $ulj/jdk1.1.6/solaris/bin/java ParseProblem_022900
      1.1.6
      input = 02/29/00, format = MM/dd/yy, output = Tue Feb 29 00:00:00 PST 2000

      I am closing this bug as integrated in 1.1.6.

      anand.palaniswamy@Eng 1999-02-23

            aliusunw Alan Liu (Inactive)
            apalanissunw Anand Palaniswamy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: