[Patch] java.text.SimpleDateFormat

Michael Koch konqueror@gmx.de
Wed Apr 20 06:02:00 GMT 2005


Hi list,


I just merged the attached patch from GNU classpath to HEAD to get a fix
for java.text.SimpleDateFormat.


Michael


2005-04-20  Sven de Marothy  <sven@physto.se>

	* java/text/SimpleDateFormat.java:
	(formatWithAttribute): Pad year before truncating digits.

-------------- next part --------------
Index: java/text/SimpleDateFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/SimpleDateFormat.java,v
retrieving revision 1.33
diff -u -r1.33 SimpleDateFormat.java
--- java/text/SimpleDateFormat.java	23 Mar 2005 21:26:00 -0000	1.33
+++ java/text/SimpleDateFormat.java	20 Apr 2005 06:00:48 -0000
@@ -680,7 +680,7 @@
 		buffer.setDefaultAttribute (DateFormat.Field.YEAR);
 		if (cf.getSize() == 2)
 		  {
-		    temp = String.valueOf (calendar.get (Calendar.YEAR));
+		    temp = "00"+String.valueOf (calendar.get (Calendar.YEAR));
 		    buffer.append (temp.substring (temp.length() - 2));
 		  }
 		else


More information about the Java-patches mailing list