Description
The fn:adjust-dateTime-to-timezone function behaves differently depending on whether the $arg date value already has a time zone, and on the value of the time zone provided.
The $timezone argument is expressed as an xs:dayTimeDuration , for example -PT5H for US Eastern Standard Time. If $timezone is the empty sequence, it is assumed that the desired result is a date value that is in no time zone. If $timezone is omitted from the function call, it is assumed to be the implicit time zone.
If $arg does not already have a time zone, its date part stays the same, but it is now associated with the specified time zone. If $arg already has a time zone, its value is adjusted to that time zone.
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type | Description |
$arg |
xs:dateTime? |
the date/time to adjust |
$timezone |
xs:dayTimeDuration? |
the timezone to adjust it to |
return value |
xs:dateTime? |
ExamplesXPath Example | Results |
---|
adjust-dateTime-to-timezone(
xs:dateTime('2006-02-15T17:00:00'),
xs:dayTimeDuration('-PT7H')) |
2006-02-15T17:00:00-07:00 |
adjust-dateTime-to-timezone(
xs:dateTime('2006-02-15T17:00:00-03:00'),
xs:dayTimeDuration('-PT7H')) |
2006-02-15T13:00:00-07:00 |
adjust-dateTime-to-timezone(
xs:dateTime('2006-02-15T17:00:00'),
()) |
2006-02-15T17:00:00 |
adjust-dateTime-to-timezone(
xs:dateTime('2006-02-15T17:00:00-03:00'),
()) |
2006-02-15T17:00:00 |
adjust-dateTime-to-timezone(
xs:dateTime('2006-02-15T01:00:00-03:00'),
xs:dayTimeDuration('-PT7H')) |
2006-02-14T21:00:00-07:00 |
The following examples assume an implicit time zone of -05:00: |
adjust-dateTime-to-timezone(
xs:dateTime('2006-02-15T17:00:00')) |
2006-02-15T17:00:00-05:00 |
adjust-dateTime-to-timezone(
xs:dateTime('2006-02-15T17:00:00-03:00')) |
2006-02-15T15:00:00-05:00 |
See AlsoHistory |
Recommended Reading:
|