Monday, May 14, 2012

Convert Java String in ISO timestamp format to SimpleDateFormat

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:




No comments:

Post a Comment