What would be the correct format to use in SimpleDateFormat to parse incoming dates that look like this: "2013-01-17T00:00:00-06:00"?
This format should work:
"yyyy-MM-dd'T'HH:mm:ssXXX"
You have to trim the last colon to align with java's zone info format of "-0600".
Try this:
String str = "2013-01-17T00:00:00-06:00";
new SimpleDataFormat("yyyy-MM-dd'T'hh:mm:ssZ").parse(str.replaceAll(":(..)$", "$1"));
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