Twitter gives me a date such as "Wed, 27 Mar 2013 15:12:14 +0000". I'm trying to parse it with:
DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss ZZZZZ").withLocale(Locale.ENGLISH);
But it fails:
Invalid format: "Wed, 03 Apr 2013 10:35:35 +0000" is malformed at "+0000"
I've tried replacing ZZZZZ
with z
, Z
, and ZZZ
, but no change. Can these dates be parsed this way?
Although you've said you've used a single Z
in the format pattern, this works:
DateTimeFormatter format =
DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss Z").withLocale(Locale.ENGLISH);
DateTime dateTime = format.parseDateTime("Wed, 27 Mar 2013 15:12:14 +0000");
When parsing this format a single Z
timezone character will suffice, 4 is invalid:
Z time zone offset/id zone -0800; -08:00; America/Los_Angeles
For more see the javadoc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With