Reputation: 1754
I'm trying the following code and I keep getting the exception:
java.text.ParseException: Unparseable date: "2015-11-05T16:24:55+02:00"
My code goes as the following:
formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
date = formatter.parse(dateValue);
My Date Input is:
2015-11-05T16:24:55+02:00
and I would like to translate it to:
05-11-2015 T16:24:55+02:00
Upvotes: 2
Views: 72
Reputation: 328855
If you use Java 7+ you can simply replace the Z
by an X
. More information about the difference between Z
(RFC822) and X
(ISO 8601) is available in the javadoc.
If you are on Java 6 or earlier, you will need to remove the :
in the original string, something like:
date = formatter.parse(dateValue.replaceAll(":(\\d+)$", "$1"));
Upvotes: 5