xf:get-days-from-dayTimeDuration

Extracts the number of days from the days 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.

Signatures

xf:get-days-from-dayTimeDuration(xf:dayTimeDuration? $dayTimeDuration-var) —> xs:integer?

Arguments

Data Type
Argument
Description

xf:dayTimeDuration?

$dayTimeDuration-var

Contains a representation of a time duration which can contain days, hours, minutes, and seconds.

Returns

Returns the number of days as an integer from days component of $dayTimeDuration-var.

Examples

Get Days from dayTimeDuration with All Components

<days>{xf:get-days-from-dayTimeDuration(xf:dayTimeDuration("P7DT25H8M20S"))}</days> 

The preceding query generates the following result:

<days>7</days> 

Note: Even though 25 hours is specified in the hours component (25H) of the dayTimeDuration creation string (adding up to an additional day), only 7 days are returned as originally specified by the days component (7D).

Get Days from dayTimeDuration with Just Negative Days

<days>{xf:get-days-from-dayTimeDuration(xf:dayTimeDuration("-PT4D"))}</days> 

The preceding query generates the following result:

<days>-4</days> 

Get Days from dayTimeDuration with No Days

<days>{xf:get-days-from-dayTimeDuration(xf:dayTimeDuration("PT2H20S"))}</days> 

The preceding query generates the following result:

<days>0</days> 

Related Topics

W3C get-days-from-dayTimeDuration function description.

W3C dayTimeDuration data type description.