From XML I receive date in the form of
value="2020-08-11T21:00:00.000Z"
I live in GMT +3 timezone, so this date should return 2020-08-12. If I simply output the date and display it in browser, it seems that it renders correctly. But when I output it to PDF using apache FOP, it shows only value shown up there.
I tried using format-dateTime()
but it outputs the date as the day before.
What else could I try?
Also, substringing is not good here. I need XSLT to automatically add 3 hours (depends on timezone) to the given date so it would return proper date.
format-date
and format-dateTime
take a timezone/place for which you want to format the date or dateTime as the fifth argument so for e.g. format-dateTime(xs:dateTime('2020-08-11T21:00:00.000Z'), '[Y0001]-[M01]-[D01] [z]', 'en', (), 'Asia/Baghdad')
you should get e.g. 2020-08-12 GMT+03:00
.