Reputation: 372
I have a request xml having a dateTime string as '2014-09-23T00:00:00.000+01:00' and I am mapping it to an element of type xs:dateTime using Mule 3.5 datamapper. The Datamapper internally applies str2Calendar(Str,Str) function or mapping. So I edited the script to look like:
output.dateAndTimeString = str2calendar(input.dateAndTime, "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
The error in log is:
java.text.ParseException: Unparseable date "2014-09-23T00:00:00.000+01:00"
Is anything wrong with Mule data-mapper or with my conversion technique?
Upvotes: 0
Views: 1724
Reputation: 11606
You can drop the 'Z' and use the overloaded str2calendar to set the default timezone. This example uses the MEL expression to get the servers timezone:
output.dateAndTimeString = str2calendar(input.dateAndTime, "yyyy-MM-dd'T'HH:mm:ss.SSS", server.timeZone);
Upvotes: 1