Patch for bug in java.text.SimpleDateFormat

Peter Graves peter at armedbear.org
Sat Jun 26 09:07:43 PDT 1999


A minor thing, but SimpleDateFormat doesn't handle the hours in HH:mm
correctly; single-digit hours should have a '0' prepended.

The attached patch fixes this.

-Peter
http://armedbear.org
-------------- next part --------------
Index: SimpleDateFormat.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/text/SimpleDateFormat.java,v
retrieving revision 1.11
diff -u -r1.11 SimpleDateFormat.java
--- SimpleDateFormat.java	1999/05/16 23:38:00	1.11
+++ SimpleDateFormat.java	1999/06/26 16:09:35
@@ -165,6 +165,8 @@
 			break;
 		case 'H':
 			val = calendar.get(Calendar.HOUR_OF_DAY);
+			if ( (plen > 1) && (val < 10) )
+				buf.append('0');
 			buf.append(val);
 			if (pos.field == HOUR_OF_DAY0_FIELD) {
 				pos.begin = cpos;


More information about the kaffe mailing list