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

jdk 1.0.2 , Date class has limited year range

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      generic
    • OS:
      solaris_2.5.1
    • Verification:
      Verified

      Description

      java.util.Date is limited to the year range (1970 - 2037) and this is inconvenient when working with historic data, birthdates, etc. A runtime exception of java.lang.IllegalArgumentException: year out of range is thrown when an incorrect year is used.

      Here is a test case :

      import java.util.*;

       
      public class DateTest
      {
       
        public static void main (String[] args)
        {
          // set the year at 2038
          Date mybd = new Date(138, 10, 15);

          System.out.println("Year : " + mybd.getYear());
          System.out.println("Month : " + mybd.getMonth());
          System.out.println("Day : " + mybd.getDay());

          System.exit(0);

        }
      }

        Attachments

          Activity

            People

            Assignee:
            duke J. Duke (Inactive)
            Reporter:
            gvanassesunw Gunter Vanasse (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: