Skip to content

Instantly share code, notes, and snippets.

@tkowalcz
Created June 10, 2015 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkowalcz/ac660693b852a85c14a0 to your computer and use it in GitHub Desktop.
Save tkowalcz/ac660693b852a85c14a0 to your computer and use it in GitHub Desktop.
Java 1.8u60 will brake time zone formatting?
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.tz.FixedDateTimeZone;
import java.util.Date;
import java.util.Locale;
public class DateFormattingBug {
private static final DateTimeZone GMT = new FixedDateTimeZone("GMT", "GMT", 0, 0);
public static void main(String[] args) {
DateTimeFormatter formatter = DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss z")
.withLocale(Locale.US)
.withZone(GMT);
String date = formatter.print(new Date().getTime());
System.out.println("date = " + date);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment