envinyater envinyater - 1 year ago 126
Java Question

Converting an ISO8601 string into DateTime format?

I have a string

that I want to convert into a

I've been trying to use Joda to get this to work but I can't get it to work.
I've hit every link I can find on the subject -- and used formatters but it simply isn't working out.

What is the best way to do this?

Answer Source

Joda Time makes this really easy, as it has built-in support for the ISO format:

DateTimeFormatter iso = ISODateTimeFormat.basicDateTimeNoMillis();
DateTime dateTime = iso.parseDateTime(text);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download