saxon:adjust-to-civil-time
Converts an xs:dateTime
to the local civil time in a named timezone.
adjust-to-civil-time($in as xs:dateTime?, $tz as xs:string) ➔ xs:dateTime?
Arguments | |||
| $in | xs:dateTime? | The date/time to be adjusted |
| $tz | xs:string | The Olson timezone name, e.g. 'America/Santiago' |
Result | xs:dateTime? |
Namespace
http://saxon.sf.net/
Saxon availability
Requires Saxon-PE or Saxon-EE.
Notes on the Saxon implementation
Available since Saxon 9.2.
Details
If the input is an empty sequence, the result is an empty sequence.
Otherwise the input dateTime
is adjusted to a dateTime
in the civil
timezone named in the second argument. This uses Olson timezone
names, for example America/New_York
or Europe/Paris
.
For example,
-
adjust-to-civil-time(xs:dateTime('2008-01-10T12:00:00Z'), 'America/New_York')
returns2008-01-10T07:00:00-05:00
-
adjust-to-civil-time(xs:dateTime('2008-07-10T12:00:00Z'), 'America/New_York')
returns2008-07-10T08:00:00-04:00
If the timezone name is not recognized, the dateTime
is adjusted to UTC.