Extracts the number of hours from the hours component of $dayTimeDuration-var.
If the value of $dayTimeDuration-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.
xf:get-hours-from-dayTimeDuration(xf:dayTimeDuration? $dayTimeDuration-var) —> xs:integer?
Contains a representation of a time duration which can contain days, hours, minutes, and seconds. |
Returns the number as hours as an integer from hours component of $dayTimeDuration-var.
<hours>{xf:get-hours-from-dayTimeDuration(xf:dayTimeDuration("P7DT9H65M20S"))}</hours>
The preceding query generates the following result:
<hours>9</hours>
Note: Even though 65 minutes is specified in the minutes component (65M) of the dayTimeDuration creation string (adding up to an additional hour), only 9 hours are returned as originally specified by the hours component (9H).
<hours>{xf:get-hours-from-dayTimeDuration(xf:dayTimeDuration("-PT3H"))}</hours>
The preceding query generates the following result:
<hours>-3</hours>
<hours>{xf:get-hours-from-dayTimeDuration(xf:dayTimeDuration("P2DT20S"))}</hours>
The preceding query generates the following result:
<hours>0</hours>
W3C get-hours-from-dayTimeDuration function description.
W3C dayTimeDuration data type description.