Reputation: 1587
I am trying to convert a String in ISO timestamp format to a SimpleDateFormat
like so:
public static void convertDate () {
String timestamp = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(new Date());
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZ");
Date date = (Date)formatter.parse(timestamp);
}
The above code throws the following exception:
java.text.ParseException: Unparseable date:
Upvotes: 0
Views: 6757
Reputation: 15363
If you are parsing date's from XML in ISO 8601 format you can use the JAXB parser.
Check this post for an example
Upvotes: 1