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

util.Date.setMonth() should wrap around end of year

XMLWordPrintable

    • 1.1
    • x86
    • windows_nt
    • Not verified

      java.util.Date.setMonth() should wrap around end of year.

      Steps to reproduce:
      Compile and run the following code

      // tests setMonth()

      import java.util.Date;

      class setMonthTest
      {
          public static void main(String args[])
          {
             Date d1 = new Date(95, 10, 21);
             System.out.println("Date " + d1);
             d1.setMonth(11);
             System.out.println("Date changed to Thu Dec 21 1995: " + d1);

             d1.setMonth(12);
             System.out.println("Date wrapped to Sun Jan 21 1996: " + d1);
          }
      }

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: