Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatting date, GMT timezone #244

Closed
AvihayTsayeg opened this issue Feb 24, 2015 · 1 comment
Closed

formatting date, GMT timezone #244

AvihayTsayeg opened this issue Feb 24, 2015 · 1 comment

Comments

@AvihayTsayeg
Copy link

private void setTimeZone(String timeZoneID) {
        setTimeZone(TimeZone.getTimeZone(timeZoneID), DateTimeZone.forID(timeZoneID));
}
private void setTimeZone(TimeZone timeZone, DateTimeZone dateTimeZone) {
        System.setProperty("user.timezone", timeZone.getID());
        TimeZone.setDefault(timeZone);
        DateTimeZone.setDefault(dateTimeZone);
}


DateTimeFormatter formatter = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss z yyyy");
dateTimeFormatter.print(new DateTime(2001, 12, 22, 23, 59, 59, 0))

"GMT" --> timeZoneID
java7 simpledateFormat --> "Mon Jan 01 00:00:00 GMT 2001"
v2.7 --> "Mon Jan 01 00:00:00 +00:00 2001"

"Europe/London" --> timeZoneID
java7 simpledateFormat --> "Mon Jan 01 00:00:00 GMT 2001"
v2.7 --> "Mon Jan 01 00:00:00 GMT 2001"

The GMT timezone format of "z" seems to behave like "Z"

Avihay

@AvihayTsayeg
Copy link
Author

Thx for the quick response 💯

Guardiola31337 pushed a commit to Guardiola31337/joda-time that referenced this issue Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants