Returns the number of hours in a duration.
fn:hours-from-duration
( $arg
as xs:duration?
xs:integer?
If $arg
is the empty sequence, the function returns the empty sequence.
Otherwise, the function returns an xs:integer
representing the hours
component in the value of $arg
. Given that a duration
is a ($months, $seconds)
tuple, the result is the value of ($seconds mod 86400) idiv 3600
.
If $arg
is a negative duration then the result will be negative.
If $arg
is an xs:yearMonthDuration
the function returns 0.
The expression fn:hours-from-duration(xs:dayTimeDuration("P3DT10H"))
returns 10
.
The expression fn:hours-from-duration(xs:dayTimeDuration("P3DT12H32M12S"))
returns 12
.
The expression fn:hours-from-duration(xs:dayTimeDuration("PT123H"))
returns 3
.
The expression fn:hours-from-duration(xs:dayTimeDuration("-P3DT10H"))
returns -10
.