SimpleDateFormat.parse() causes Unparsable date exception
807605Aug 31 2007 — edited Aug 31 2007I am using SimpleDateFormat to both format and parse date strings. The format is working properly, but parse results in the following exception:
java.text.ParseException: Unparseable date: "2007-08-31T12:05:05.651-0700"
at java.text.DateFormat.parse(Unknown Source)
Here is my code:
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ss.SZ");
String dateTime = dateFormatter.format(new Date());
Date test = dateFormatter.parse(dateTime);
For testing purposes, I am formatting a date string, and then passing it right back into parse() and I get the exception.
I am using jre1.5.0_10.
Thank you for your help.
-Karen