Other | Other | Other | Other | Other | Other |
---|---|---|---|---|---|
1.1.6_007 007Fixed | 1.1.7Fixed | 1.1.8Fixed | 1.2.1_003Fixed | 1.2.2Fixed | 1.3.1Resolved |
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
Name: gsC80088 Date: 02/05/99 SimpleDateFormat does not correctly consider leap years in the following code. This only occurs in jdk1.2. It works correctly on 1.1.6 import java.lang.*; import java.util.*; import java.text.*; public class testdate { public testdate() { } public static void main(String[] arg) { SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); format.setLenient(false); try { String normal = "03/13/1998 12:22:43"; String leap2000 = "02/29/2000 13:40:22"; String leap1996 = "02/29/1996 08:15:15"; System.out.println("Normal date:"); Date dnorm = format.parse(normal); System.out.println(dnorm); System.out.println("2000 date:"); Date d2000 = format.parse(leap2000); System.out.println(d2000); System.out.println("1996 date:"); Date d1996 = format.parse(leap1996); System.out.println(d1996); } catch(ParseException pe) { System.out.println(pe); } catch(Exception e) { System.out.println(e); } } } output from 1.2: Normal date: Fri Mar 13 12:22:43 EST 1998 2000 date: java.text.ParseException: Unparseable date: "02/29/2000 13:40:22" output from 1.1.6: Normal date: Fri Mar 13 12:22:43 EST 1998 2000 date: Tue Feb 29 13:40:22 EST 2000 1996 date: Thu Feb 29 08:15:15 EST 1996 (Review ID: 53564) ======================================================================
|