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

    • 1.1
    • x86
    • windows_nt
    • Not verified

      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);
          }
      }

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: