Extracts the hours from $time-var.
If the value of $time-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-time(xs:time? $time-var) —> xs:integer?
Returns the hours as an integer from $time-var.
The following is a simple example using the get-hours-from-time function:
<hours>{xf:get-hours-from-time("22:21:01")}</hours>
The preceding query generates the following result:
<hours>22</hours>
The following example uses the get-hours-from-time function with a timezone:
<hours>{xf:get-hours-from-time("14:21:01-05:00")}</hours>
The preceding query generates the following result:
<hours>19</hours>
In the preceding query, the -05:00 string specifies the time is specified in the Eastern Standard timezone which is 5 hours behind Coordinated Universal Time (UTC). The hours are reported in Coordinated Universal Time (UTC), so 5 hours are added to 14 hours of the Eastern Standard timezone, resulting in 19 hours in Coordinated Universal Time (UTC).
W3C get-hours-from-time function description.
W3C time data type description.