I want to convert datetime string to desired datetime format eg: "YYYY-MM-DDTHH:MM:SS".
Input: Sun, 05 Jan 2025 15:53:10 GMT Output: 2025-01-05T15:53:10
Are there any XQuery functions to convert it?
In XQuery 3.1, use parse-ietf-date
e.g. parse-ietf-date('Sun, 05 Jan 2025 15:53:10 GMT')
to get an xs:dateTime
(e.g. 2025-01-05T15:53:10Z
), then you can use format-dateTime
(e.g. with '[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]'
) to get any desired output string.