timezone-from-time function

The fn:timezone-from-time function returns the time zone component of an xs:time value.

Syntax

Read syntax diagramSkip visual syntax diagramfn:timezone-from-time( time-value)
time-value
The time value from which the timezone component is to be extracted.

time-value is of type xs:time, or is an empty sequence.

Returned value

If time-value is of type xs:time and has an explicit timezone component, the returned value is of type xdt:dayTimeDuration, and the value is between -PT14H and PT14H, inclusive. The value is the deviation of the time-value timezone component from UTC time zone.

If time-value does not have an explicit timezone component, or is an empty sequence, the returned value is an empty sequence.

Examples

The following function returns the timezone component of the time value for 12 noon in the UTC-5 time zone.

fn:timezone-from-time(xs:time("12:00:00-05:00"))

The returned value is -PT5H.

In the following function, the time value for 1:00 pm does not have a timezone component.

fn:timezone-from-time(xs:time("13:00:00"))

The returned value is the empty sequence.