Commit 1aa605c8 by Warren Levy Committed by Warren Levy

SimpleDateFormat.java (format): Compute hour for cases HOUR_OF_DAY1_FIELD (1-24)...

	* 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).

From-SVN: r39147
parent 03bbd83f
2001-01-19 Warren Levy <warrenl@redhat.com>
* 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.
2001-01-17 Mark Wielaard <mark@klomp.org> 2001-01-17 Mark Wielaard <mark@klomp.org>
* java/bean/Beans.java (instantiate): enable Applet code from Classpath * java/bean/Beans.java (instantiate): enable Applet code from Classpath
...@@ -104,7 +110,6 @@ ...@@ -104,7 +110,6 @@
non-standard ones. non-standard ones.
(getDefaultTimeZoneId): Removed. (getDefaultTimeZoneId): Removed.
(zoneGMT): Removed. (zoneGMT): Removed.
(getDefaultTimeZoneId): Removed.
* java/util/natTimeZone.cc: Removed. * java/util/natTimeZone.cc: Removed.
2001-01-08 Bryce McKinlay <bryce@albatross.co.nz> 2001-01-08 Bryce McKinlay <bryce@albatross.co.nz>
......
/* SimpleDateFormat.java -- A class for parsing/formating simple /* SimpleDateFormat.java -- A class for parsing/formating simple
date constructs 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. This file is part of GNU Classpath.
...@@ -411,8 +411,8 @@ public class SimpleDateFormat extends DateFormat ...@@ -411,8 +411,8 @@ public class SimpleDateFormat extends DateFormat
case DATE_FIELD: case DATE_FIELD:
withLeadingZeros(theCalendar.get(Calendar.DATE),p.size,buffer); withLeadingZeros(theCalendar.get(Calendar.DATE),p.size,buffer);
break; break;
case HOUR_OF_DAY1_FIELD: // 1-12 case HOUR_OF_DAY1_FIELD: // 1-24
withLeadingZeros(theCalendar.get(Calendar.HOUR),p.size,buffer); withLeadingZeros(((theCalendar.get(Calendar.HOUR_OF_DAY)+23)%24)+1,p.size,buffer);
break; break;
case HOUR_OF_DAY0_FIELD: // 0-23 case HOUR_OF_DAY0_FIELD: // 0-23
withLeadingZeros(theCalendar.get(Calendar.HOUR_OF_DAY),p.size,buffer); withLeadingZeros(theCalendar.get(Calendar.HOUR_OF_DAY),p.size,buffer);
...@@ -447,11 +447,11 @@ public class SimpleDateFormat extends DateFormat ...@@ -447,11 +447,11 @@ public class SimpleDateFormat extends DateFormat
case AM_PM_FIELD: case AM_PM_FIELD:
buffer.append(formatData.ampms[theCalendar.get(Calendar.AM_PM)]); buffer.append(formatData.ampms[theCalendar.get(Calendar.AM_PM)]);
break; break;
case HOUR1_FIELD: // 1-24 case HOUR1_FIELD: // 1-12
withLeadingZeros(theCalendar.get(Calendar.HOUR_OF_DAY)+1,p.size,buffer); withLeadingZeros(((theCalendar.get(Calendar.HOUR)+11)%12)+1,p.size,buffer);
break; break;
case HOUR0_FIELD: // 0-11 case HOUR0_FIELD: // 0-11
withLeadingZeros(theCalendar.get(Calendar.HOUR)-1,p.size,buffer); withLeadingZeros(theCalendar.get(Calendar.HOUR),p.size,buffer);
break; break;
case TIMEZONE_FIELD: case TIMEZONE_FIELD:
TimeZone zone = theCalendar.getTimeZone(); TimeZone zone = theCalendar.getTimeZone();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment