Parse ISO-8601 Date Format in Java

Here is code snippet to convert and parse String ISO-8601 formatted date using Joda-Time in Java.
In this case I have to parse it to more readable date time format.

String isoDate = "2015-09-03T12:32:45+0000";
DateTime dt = new DateTime(isoDate);
String newDate = dt.toString("d MMM YYYY, k:m"); // for more advanced pattern see http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
System.out.println(newDate); // 3 Sep 2015, 12:32

Reference: http://stackoverflow.com/a/20578792

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s