Hopefully someone else out there uses Altova Mapforce for this.
Using XSLT to convert one xml to another, in the source XML they have the dates as M/D/YYYY, i need to convert them to the standard datetime format used by.. well, everything.
So, i'm playing with using the tokenize function of XSLT to split on / to get my parts, now, i want to take part 1 and say it's the day, but not sure how to assign results of the tokenize expression to variables using MapForce.
Anyone else do this? or rather, what's the best way to convert a string date to a datetime?
Thanks for the ideas
EDIT. my input is a string '1/31/2012' and my output needs to be xs:dateTime (or xs:date, assuming that xs:date can be easily converted to dateTime)
I've got a method setup to concatenate strings together and convert them to YYYY-MM-DD format, but it still reports that this is invalid for dateTime (Cast Failed, invalid lexical value 2012-1-31)
Perhaps YYYY-MM-DD is not the valid format for dateTime?
Ended up creating a component to do this. my particular problem was that '2012-1-31' cannot be formatted to a date or dateTime, however 2012-01-31 can. so this became as simple as formatting the number and padding with characters before trying to cast as a date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With