fn:hours-from-time

Returns the hours component of an xs:time.

Signature

fn:hours-from-time($arg as xs:time?) as xs:integer?

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 an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the local value of $arg.

Examples

Assume that the dynamic context provides an implicit timezone value of -05:00.

The expression fn:hours-from-time(xs:time("11:23:00")) returns 11.

The expression fn:hours-from-time(xs:time("21:23:00")) returns 21.

The expression fn:hours-from-time(xs:time("01:23:00+05:00")) returns 1.

The expression fn:hours-from-time(fn:adjust-time-to-timezone(xs:time("01:23:00+05:00"), xs:dayTimeDuration("PT0S"))) returns 20.

The expression fn:hours-from-time(xs:time("24:00:00")) returns 0.