Reputation: 2121
How do I convert Strings of the form "Sun Feb 25 19:31:07 +0000 2018" to xs:dateTime
in XQuery? Maybe first converting the String into an ISO 8601 datetime format?
Upvotes: 1
Views: 230
Reputation: 167716
With that format you got lucky as parse-ietf-date("Sun Feb 25 19:31:07 +0000 2018")
should do: https://xqueryfiddle.liberty-development.net/3Nqn5Yh/1.
According to https://maxtoroq.github.io/xpath-ref/ the parse-ietf-date
https://www.w3.org/TR/xpath-functions/#func-parse-ietf-date function is new in XQuery 3.1, so check whether your XQuery engine supports it. If not, you can perhaps use an extension module or function of the particular processor or engine you use or call into Java or another platform/language for the parsing.
Upvotes: 3