I am trying to parse date JSON response in java
"2014-12-16T13:17:27.943Z"
This is the format of date which I am getting in the JSON.
What is the string pattern to be used for SimpleDateFormat
to convert it to Date
object.
You can try to use
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX")
This format will take care of both the formats like
"2014-12-16T13:17:27.943Z" and "2014-12-16T13:17:27.943+0000"
You can also check JodaTime if you are open to use some other Java's built-in Date/Time/Calendar classes.