I want to parse a timestamp given in this format timestamp="2015-05-21 12:38:00Z"
using the class SimpleDateFormat
. The problem is the "Z"
in the end of timestamp
which specifies the time zone. Unfortunately
new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ")
doesn't do the job. It throws me:
java.text.ParseException: Unparseable date: "2015-05-21 12:38:00Z"
If I use
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'Z'")
the string can be parsed but the time zone "Z"
is neglected.
How can that problem be solved?