adjust-date-to-timezone
Adjusts an xs:date value to a specific time zone, or to no time zone at all. If the timezone argument is an empty sequence, the function returns an xs:date without a time zone. Otherwise, it returns an xs:date with a time zone.
Languages
XQuery, XSLT 2.0, XSLT 3.0.
Parameters
Name | Type | Description |
---|---|---|
date | xs:date | The input value of type xs:date. |
timezone | xs:dayTimeDuration | The time zone expressed as an xs:dayTimeDuration value. The value can be negative. For example, a time zone value of -5 hours can be expressed as -PT5H. |
Example
The following mapping constructs both parameters to the adjust-date-to-timezone function from strings, using the corresponding XPath 2 constructor functions. The goal of the mapping is to adjust the time zone to -5 hours. This time zone can be expressed as -PT5H.
XSLT 2.0 mapping
The function adjusts the date value to the time zone supplied as argument. Consequently, the mapping output is 2020-04-30-05:00.