Adds a time zone to a time value. The timezone added to the time value is either the implicit time zone or passed in with the optional argument: $dayTimeDuration-var.
Note: The implicit time zone is obtained from the current environment. For example, if the time zone specified on your machine is the PSD (Pacific Daylight Savings), the implicit time zone would be -07:00.
Adds a time zone to a time value by invoking the following steps:
xf:add-timezone-to-time(xs:time $time-var) —> xs:time
xf:add-timezone-to-time(xs:time $time-var, xf:dayTimeDuration, $dayTimeDuration-var) —> xs:time
Time zone to remove to $time-var. (Optional, if not specified the implicit time zone is used). |
Returns a time with a time zone.
If $time-var contains a time zone and optional argument $dayTimeDuration-var is not specified, the passed in date and time are returned with no conversion.
The following example adds the specified time zone to the specified time value. In this example, the specified time value: 12:00:00, initially does not have a timezone zone associated with it.
Adding the specified time zone to the specified time value, by invoking xf:date-timezone-to-time(xs:time("12:00:00", dayTimeDuration("-PT7H"))), causes the following internal conversion steps:
let $timeWithNoTimezone := xs:time("12:00:00") return <result> <timeWithNoTimezone>{$timeWithNoTimezone}</timeWithNoTimezone> <timeWithTimeZoneAdded>{ xf:add-timezone-to-time(xs:time($timeWithNoTimezone), xf:dayTimeDuration("-PT7H")) }</timeWithTimeZoneAdded> </result>
The preceding query produces the following result:
<result> <timeWithNoTimezone>12:00:00</timeWithNoTimezone> <timeWithTimeZoneAdded>19:00:00Z</timeWithTimeZoneAdded> </result>
Note: The Z at the end of the 19:00:00Z value specifies that the time value is in UTC time.
The following example adds the implicit time zone to the specified time value. In this example, the specified time value: 12:00:00, initially does not have a timezone zone associated with it.
In this example, the implicit time zone is assumed to be -07:00, the Pacific Daylight Savings Time (PST) time zone. (The implicit time zone is the default time zone for the current machine.)
Adding the implicit time zone to the specified time value, by invoking xf:add-timezone-to-time(xs:time("12:00:00")), causes the following internal conversion steps:
let $timeWithNoTimezone := xs:time("12:00:00") return <result> <timeWithNoTimezone>{$timeWithNoTimezone}</timeWithNoTimezone> <timeWithTimeZoneAdded>{ xf:add-timezone-to-time(xs:time($timeWithNoTimezone)) } </timeWithTimeZoneAdded> </result>
The preceding query produces the following result:
<result> <timeWithNoTimezone>12:00:00</timeWithNoTimezone> <timeWithTimeZoneAdded>19:00:00Z</timeWithTimeZoneAdded> </result>
Note: The Z at the end of the 19:00:00Z value specifies that the time value is in UTC time.
Note: The results of this query maybe be different for your machine because the implicit time zone may be different.
W3C add-timezone-to-time function description.
W3C time data type description.
W3C dayTimeDuration operator description.