diff options
author | warrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-20 00:37:09 +0000 |
---|---|---|
committer | warrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-20 00:37:09 +0000 |
commit | 6ac4fd7ce885cf9363c45ab0de6edc69c9055e0e (patch) | |
tree | 1bc8189e8d7cb91fe3547f914800a3d7919eb240 /libjava/java/text/SimpleDateFormat.java | |
parent | e01fe443f19228a655cef5bdbd31a14713889ce0 (diff) | |
download | ppe42-gcc-6ac4fd7ce885cf9363c45ab0de6edc69c9055e0e.tar.gz ppe42-gcc-6ac4fd7ce885cf9363c45ab0de6edc69c9055e0e.zip |
* java/text/SimpleDateFormat.java (format): Compute hour for cases
HOUR_OF_DAY1_FIELD (1-24), HOUR1_FIELD (1-12), and HOUR0_FIELD (0-11)
correctly. Adjust properly from 0-23 clock hour.
Fixes failure in Mauve test java.text.SimpleDateFormat.Test (format).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39147 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/text/SimpleDateFormat.java')
-rw-r--r-- | libjava/java/text/SimpleDateFormat.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java index c0332bf71d8..50cd99b91ea 100644 --- a/libjava/java/text/SimpleDateFormat.java +++ b/libjava/java/text/SimpleDateFormat.java @@ -1,6 +1,6 @@ /* SimpleDateFormat.java -- A class for parsing/formating simple date constructs - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -411,8 +411,8 @@ public class SimpleDateFormat extends DateFormat case DATE_FIELD: withLeadingZeros(theCalendar.get(Calendar.DATE),p.size,buffer); break; - case HOUR_OF_DAY1_FIELD: // 1-12 - withLeadingZeros(theCalendar.get(Calendar.HOUR),p.size,buffer); + case HOUR_OF_DAY1_FIELD: // 1-24 + withLeadingZeros(((theCalendar.get(Calendar.HOUR_OF_DAY)+23)%24)+1,p.size,buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 withLeadingZeros(theCalendar.get(Calendar.HOUR_OF_DAY),p.size,buffer); @@ -447,11 +447,11 @@ public class SimpleDateFormat extends DateFormat case AM_PM_FIELD: buffer.append(formatData.ampms[theCalendar.get(Calendar.AM_PM)]); break; - case HOUR1_FIELD: // 1-24 - withLeadingZeros(theCalendar.get(Calendar.HOUR_OF_DAY)+1,p.size,buffer); + case HOUR1_FIELD: // 1-12 + withLeadingZeros(((theCalendar.get(Calendar.HOUR)+11)%12)+1,p.size,buffer); break; case HOUR0_FIELD: // 0-11 - withLeadingZeros(theCalendar.get(Calendar.HOUR)-1,p.size,buffer); + withLeadingZeros(theCalendar.get(Calendar.HOUR),p.size,buffer); break; case TIMEZONE_FIELD: TimeZone zone = theCalendar.getTimeZone(); |