SimpleDateFormat produces different timezone outputs in Android vs JDK

Viewed 599

There's a lot of questions on here on SimpleDateFormat but I can't seem to find anything on this issue. I'm running into issues with different output from the exact same code running on Android vs the JDK. I'm running in Eclipse and using the emulator to test Android. JDK version 1.7 and Android 4.4.

Any ideas on how to make Android output dates in the JDK style format?

TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
String RFC1123_PATTERN = "EEE, dd MMM yyyy HH:mm:ss z";

final DateFormat rfc1123Format = new SimpleDateFormat(RFC1123_PATTERN, LOCALE_US);
rfc1123Format.setTimeZone(GMT_ZONE);
String dateString = rfc1123Format.format(new Date()); 

JDK 1.7 dateString value: Fri, 20 Dec 2013 00:46:21 GMT

Android 4.4 dateString value: Fri, 20 Dec 2013 00:46:21 GMT+00:00

2 Answers
Related