Wednesday, December 3, 2008

Converting Date from xml unmarshalled format to the standard representation.

Converting from "2008-12-03T12:46:35.896+02:00" to "Wed Dec 03 12:46:35 GMT+02:00 2008".


String dt = "yyyy-MM-dd'T'HH:mm:ss'.'SSSZZZZZ";
SimpleDateFormat sdf = new SimpleDateFormat(dt);
String outDateString = source.substring(0, 26) + source.substring(27, 29);
Date outDate = sdf.parse(outDateString);

No comments: