XPath/XQuery timezone-from-date function

Summary

Returns the timezone component of an xs:date.

Signature

fn:timezone-from-date(
$arg as xs:date?
) as xs:dayTimeDuration?

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

If $arg is the empty sequence, the function returns the empty sequence.

Otherwise, the function returns the timezone component of $arg, if any. If $arg has a timezone component, then the result is an xs:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. If $arg has no timezone component, the result is the empty sequence.

Examples

The expression fn:timezone-from-date(xs:date("1999-05-31-05:00")) returns xs:dayTimeDuration("-PT5H").

The expression fn:timezone-from-date(xs:date("2000-06-12Z")) returns xs:dayTimeDuration("PT0S").