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

Dates for years before 0ce print incorrectly (there is no indication that the ye

XMLWordPrintable



      Name: dgC58589 Date: 12/08/97


      Compute a date corresponding to more that 1997 years ago. Print it.

      import java.util.Date;

      public class T extends Object
      {
              public static void main( String[] argv )
              {
                      Date d = new Date();
                      System.out.println( "Date[1]:" + d );
                      d.setTime( d.getTime() - 2000L*365L*24L*60L*60L*1000L );
                      System.out.println( "Date[2]:" + d );
              }
      }

      The output is:
      Date[1]:Mon Dec 08 11:46:00 EST 1997
      Date[2]:Wed Apr 09 11:46:00 EST 0002

      and should be something like

      Date[1]:Mon Dec 08 11:46:00 EST 1997
      Date[2]:Wed Apr 09 11:46:00 EST 0002 BC


      (Review ID: 21519)
      ======================================================================

            aliusunw Alan Liu (Inactive)
            dgrahamcsunw David Graham-cumming (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: