I have problems finding a java date pattern that correctly reads this date from a string:
2012-01-17T11:53:40+00:00
If the timezone would be standard (+0000), this pattern would work:
yyyy-MM-dd'T'HH:mm:ssZ
but this is not the case. The small z
doesn't match either.
Replace the last colon by an empty string, and then parse. Simplest solutions are sometimes the best ones.
In Java 7, you can use the letter X
to represent an ISO 8601 time zone.
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
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