Cast failed, invalid lexical value - xs:dateTime

1.3k views Asked by At

I am trying to convert a string to date in Altova StyleVision using an Xpath Expression but I am getting this error.

Error in XPath 2.0 expression
Line 358, Character 32


(Cast failed, invalid lexical value - xs:dateTime '2017-16-09T12:16:59.407+03:00')

My expression is below.

format-dateTime(xs:dateTime('2017-16-09T12:16:59.407+03:00'), '[Y0001]/[M01]/[D01]')

Any help will be highly appreciated.

1

There are 1 answers

1
Michael Kay On BEST ANSWER

It's an unhelpful error message. Saxon does better:

Error on line 1 column 29 of file:/Users/mike/Desktop/temp/:
  FORG0001: Invalid dateTime value "2017-16-09T12:16:59.407+03:00" (Month is out of range)

The problem is that there is no month 16.