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.
The patterm SSS
stands for Millisecond
- which means that your input needs to have 3 decimal places after the second - see here.
Your input, however, has no millisecond information. You have to remove the SSS
or add the digits manually (.000
).