Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SimpleDateFormat.parse() causes Unparsable date exception

807605Aug 31 2007 — edited Aug 31 2007
I 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2007
Added on Aug 31 2007
3 comments
1,720 views