diff options
author | Sven de Marothy <sven@physto.se> | 2005-02-06 00:20:57 +0000 |
---|---|---|
committer | Sven de Marothy <sven@physto.se> | 2005-02-06 00:20:57 +0000 |
commit | 2ce566699d7ed1b47900e0f33a845d1f03976f9c (patch) | |
tree | b760e246d35e55c8cdebf630065a03f4a0c06712 /java/text/SimpleDateFormat.java | |
parent | 86341a0bb0bcee43b8f3c0deed4088fb115fefb6 (diff) | |
download | classpath-2ce566699d7ed1b47900e0f33a845d1f03976f9c.tar.gz |
2005-02-06 Sven de Marothy <sven@physto.se>
* java/text/SimpleDateFormat.java
(parse): Tweak handling of 2-year dates
* java/util/Calendar.java
(clear): Clear fields to correct value.
* java/util/GregorianCalendar.java
(computeTime): Correct handling of time zones.
Correct field minimum values.
Diffstat (limited to 'java/text/SimpleDateFormat.java')
-rw-r--r-- | java/text/SimpleDateFormat.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/java/text/SimpleDateFormat.java b/java/text/SimpleDateFormat.java index 85090f854..388043bfb 100644 --- a/java/text/SimpleDateFormat.java +++ b/java/text/SimpleDateFormat.java @@ -1096,7 +1096,10 @@ public class SimpleDateFormat extends DateFormat // exactly 2 digits. int digit_count = pos.getIndex() - index; if (digit_count == 2) - is2DigitYear = true; + { + is2DigitYear = true; + value += defaultCentury; + } } // Assign the value and move on. @@ -1107,8 +1110,7 @@ public class SimpleDateFormat extends DateFormat { // Apply the 80-20 heuristic to dermine the full year based on // defaultCenturyStart. - int year = defaultCentury + calendar.get(Calendar.YEAR); - calendar.set(Calendar.YEAR, year); + int year = calendar.get(Calendar.YEAR); if (calendar.getTime().compareTo(defaultCenturyStart) < 0) calendar.set(Calendar.YEAR, year + 100); } |