0
votes

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?

1

1 Answers

1
votes

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);