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

Date.setYear() does not recalc when going from leap day to non-leap year.

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Not verified

      Description

      java.util.Date.setYear() does not recalc month, or date when going from 29-Feb-1992
      (a leap year) to a non-leap year.

      Steps To Reproduce
      Compile and run the following code

      import java.util.Date;

      public class LeapYearTest
      {
          public static void main(String args[])
          {
              Date d = new Date(92, 01, 29);
              System.out.println("29-Feb-92 " + d);

              d.setYear(93);
              System.out.println("Unknown Date: " + d);
          }
      }

        Attachments

          Activity

            People

            Assignee:
            duke J. Duke (Inactive)
            Reporter:
            kasmithsunw Kevin Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: