Reputation: 4353
I have timestamp string like "2015-07-13T10:44:58Z" whe I try convert this in date object it always generates the exception
Caused by: java.text.ParseException: Unparseable date: "2015-07-13T10:44:58Z"
Code which I am using for parsing is like that
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
Date subscriptionDate = format.parse("2015-07-13T10:44:58Z");
I don't know what I am doing wrong.
Upvotes: 1
Views: 979
Reputation: 1306
Your input is inconsistent with your pattern: pattern has millisecond information (.SSS) while input does not (it ends with seconds followed by 'Z'). So you should either provide milliseconds in your input or remove .SSS from date pattern
Upvotes: 1