We're updating the issue view to help you get more done. 

Anomalous parse of 2-digit years by DateFormat

Description

DateFormat parses some 2-digit year strings strangely. Here is the
self-explanatory test output, run against 1.3:

02/29/00 => Feb 29 2000 AD
01/23/01 => Jan 23 2001 AD
FAIL: 04/05/-1 => Apr 05 1999 AD, expected Apr 05 0002 BC
FAIL: 01/23/-9 => Jan 23 1991 AD, expected Jan 23 0010 BC
#####/12/1314 => Nov 12 1314 AD
FAIL: 10/31/1 => Oct 31 2001 AD, expected Oct 31 0001 AD
09/12/+1 => null
09/12/001 => Sep 12 0001 AD

---ERRORS (1) in Test4182066

This is considered a Y2K bug.

The fix is to constrain 2-digit year parsing so that ONLY year strings "00"
through "99" parse as 2-digit years; all other strings, including "1", "0",
"-1", etc., parse as literal year values ("1" -> 1 A.D., "-1" -> 2 B.C., etc.).

{JDK Bug 4182066}

Environment

Status

Assignee

TracBot

Reporter

TracBot

Labels

tracCreated

Oct 15, 1999, 12:07 AM

tracReporter

alan@8d6336d19dc03735

tracResolution

fixed

tracStatus

closed

Components

Priority

assess