harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r428669 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
Date Fri, 04 Aug 2006 09:06:44 GMT
Author: hindessm
Date: Fri Aug  4 02:06:43 2006
New Revision: 428669

URL: http://svn.apache.org/viewvc?rev=428669&view=rev
Log:
Applied patch from "[#HARMONY-501] Date year output needs updating for 5.0".

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java?rev=428669&r1=428668&r2=428669&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
Fri Aug  4 02:06:43 2006
@@ -605,10 +605,18 @@
 	 * @deprecated use DateFormat
 	 */
 	public String toGMTString() {
-		SimpleDateFormat format = new SimpleDateFormat(
-				"d MMM yyyy HH:mm:ss 'GMT'", Locale.US); //$NON-NLS-1$
-		format.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
-		return format.format(this);
+		SimpleDateFormat format1 = new SimpleDateFormat(
+				"d MMM ", Locale.US); //$NON-NLS-1$
+		SimpleDateFormat format2 = new SimpleDateFormat(
+				" HH:mm:ss 'GMT'", Locale.US); //$NON-NLS-1$
+                TimeZone gmtZone = TimeZone.getTimeZone("GMT"); //$NON-NLS-1$
+		format1.setTimeZone(gmtZone);
+		format2.setTimeZone(gmtZone);
+                GregorianCalendar gc = new GregorianCalendar(gmtZone);
+		gc.setTimeInMillis(milliseconds);
+		return format1.format(this) + 
+                       gc.get(Calendar.YEAR) + 
+                       format2.format(this);
 	}
 
 	/**
@@ -629,8 +637,9 @@
 	 * @return the string representation of this Date
 	 */
 	public String toString() {
-		return new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy", Locale.US) //$NON-NLS-1$
-				.format(this);
+		return new SimpleDateFormat("E MMM dd HH:mm:ss z ", Locale.US) //$NON-NLS-1$
+				.format(this) + 
+                                new GregorianCalendar(milliseconds).get(Calendar.YEAR);
 	}
 
 	/**



Mime
View raw message