xf:get-hours-from-dateTime

Extracts the hours from $dateTime-var.

If the value of $dateTime-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.

Signatures

xf:get-hours-from-dateTime(xs:dateTime? $dateTime-var) —> xs:integer?

Arguments

Data Type
Argument
Description

xs:dateTime?

$dateTime-var

Contains a representation of the date and time.

Returns

Returns the hours as an integer from $dateTime-var.

Examples

Simple

When you invoke the following query:

<hours>{xf:get-hours-from-dateTime("2002-08-30T22:21:01")}</hours> 

The preceding query generates the following result:

<hours>22</hours> 

Timezone

The following example uses the get-hours-from-dateTime function with a timezone:

<hours>{xf:get-hours-from-dateTime("2002-08-30T14: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).

Related Topics

W3C get-hours-from-dateTime function description.

W3C dateTime data type description.