IsaacK
IsaacK

Reputation: 1298

Cast failed, invalid lexical value - xs:dateTime

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.

Upvotes: 0

Views: 1406

Answers (1)

Michael Kay
Michael Kay

Reputation: 163625

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.

Upvotes: 1

Related Questions