Xslt datetime conversion

Viewed 52

I am receving the date in xsd:dateTime format "2021-10-20T15:30:46Z" and I want to convert the same to "2021-10-20T15:30:46.000+04:00" in xslt 2.0.

I am not able to get the right picture string.

format-dateTime($DateTime, "[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001]Z") 

but it is returning "2021-10-20T15:30:46Z"

1 Answers

This is not a problem of formatting. In order to get the result you want, you need to (a) subtract 4 hours from the given dateTime and (2) adjust the result to a timezone with offset of 4 hours:

adjust-dateTime-to-timezone(xs:dateTime($DateTime) - xs:dayTimeDuration('PT4H'), xs:dayTimeDuration('PT4H'))
Related