timezone-from-date function

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

Syntax

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

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

Returned value

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

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

Example

The following function returns the timezone component of the date value for March 13, 2007 in the UTC-8 time zone.

fn:timezone-from-date(xs:date("2007-03-13-08:00"))

The returned value is -PT8H.