So I am receiving date in 2017-01-01T01:34:00+00:00 format from server and I have below SimpleDateFormatter picked up after seeing many examples.
SimpleDateFormat serverToClientFormat=
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'",Locale.getDefault());
But when I try to parse it with below lines
serverToClientFormat.parse(object.getString("date"))
the string received from server to date format, it throws
java.text.ParseException: Unparseable date: "2017-01-01T01:34:00+00:00"
What probably could I try else to parse above format?
You are using the literal
Zinstead of theZpattern letter - so your format expects the letter Z in the input, not a time zone offset.Also, the
Zpattern doesn't accept the:in the offset. Try withXinstead (without the single quotes) and it should work fine:Live Example