In my application, there are the following 2 cases I need to handle:
- I have a "xs:date" and I need to convert it to "xs:dateTime"
- I have a "xs:date" and a "xs:time" and I need to combine them into "xs:dateTime"
Following the answer for this question on Stackoverflow, I tried both "xs:dateTime($date)" and "fn:dateTime($date, $time)" but none of them worked.
When I used "xs:dateTime($date)" to handle the 1st case, I got the following exception when OSB reaches the conversion step for the date:
OSB Replace action failed updating variable "body": Error parsing XML: {err}XP0021: "2014-12-09": can not cast to {http://www.w3.org/2001/XMLSchema}dateTime: error: date: Invalid date value: wrong type: 2014-12-09
When I used "fn:dateTime($date, $time)", the transformation is not even accepted by the IDE. It displays the following error:
line 113, column 42: "{http://www.w3.org/2004/07/xpath-functions}dateTime" unknown function (or number of arguments (2) is wrong
At the moment, as a workaround, I am using "concat" to combine the date and time fields in the 2nd case and to append "T00:00:00" to handle the 1st case but I feel this is not a good approach.
I'd be very grateful if you could show me how I can properly convert date fields into dateTime format.