Reputation: 349
Is Joda parsing this ISO 8601 datetime string incorrectly?
DateTimeFormatter f = DateTimeFormat.forPattern("EEE MMM ee kk:mm:ss z y").withZone(DateTimeZone.UTC).withLocale(Locale.US);
DateTimeFormatter dtf = ISODateTimeFormat.dateTimeNoMillis();
dt = dtf.parseDateTime("2015-04-01T11:40:59Z");
System.out.println(f.print(dt));
This outputs Wed Apr 03 11:40:59 UTC 2015 but notice the input string specified April 01
Upvotes: 1
Views: 70
Reputation: 312116
e
is the day of the week. You're looking for d
, which is the day of the month:
DateTimeFormatter f = DateTimeFormat.forPattern("EEE MMM dd kk:mm:ss z y").withZone(DateTimeZone.UTC).withLocale(Locale.US);
Upvotes: 4