Reputation: 4345
Why am I getting this exception?
Here is my format string:
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
Here is the string I want to format:
2012-12-29T23:59:00-05:00
But I get the following exception:
java.text.ParseException: Unparseable date: "2012-12-29T23:59:00-05:00"
at java.text.DateFormat.parse(DateFormat.java:337)
at objectmodels.Checkout.setDueDate(Checkout.java:72)
at threads.AccountNotifyThread.lookupAccountInfo(AccountNotifyThread.java:220)
at threads.AccountNotifyThread.performNotificationsForUser(AccountNotifyThread.java:65)
at threads.AccountNotifyThread.run(AccountNotifyThread.java:42)
at java.lang.Thread.run(Thread.java:680)
Upvotes: 2
Views: 984
Reputation: 11120
It because Z
expects -0500
and not -05:00
so the date should be 2012-12-29T23:59:00-0500
.
You'll have to get rid of that last :
Upvotes: 4
Reputation: 1073
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
Try the z instead of Z.
Upvotes: 0