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

Not Support DataTime with Zone #38

Open
kangpengjie opened this issue Sep 8, 2016 · 0 comments
Open

Not Support DataTime with Zone #38

kangpengjie opened this issue Sep 8, 2016 · 0 comments

Comments

@kangpengjie
Copy link

@test
public void testJodaDateZoneUsingGson() throws Exception{
Gson gson = Converters.registerDateTime(new GsonBuilder()).create();
DateTime now = new DateTime(2016,8,29,15,10,30);
DateTimeZone dtz = DateTimeZone.forID("Europe/Berlin");
DateTime now1 = now.withZone(dtz);
System.out.println(now1 + "," + now1.getZone());
String nowStr1 = gson.toJson(now1);

    DateTime convertedNow1 = gson.fromJson(nowStr1, DateTime.class);
    assertEquals("Europe/Berlin", convertedNow1.getZone().toString());
}

The convertedNow1.getZone() return is Local Zone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant