The days-from-date() Function

Release 2.0 - ...

Syntax

  CopyCode image Copy Code
number days-from-date(string)

Description

This function returns a whole number of days, according to the following rules:

  • If the string parameter represents a legal lexical xsd:date or xsd:dateTime, the return value is equal to the number of days difference between the specified date or dateTime (normalized to UTC) and 1970-01-01.
    Hour, minute, and second components are ignored after normalization. Any other input parameter causes a return value of NaN.

Example

XML CopyCode image Copy Code
<xforms:output value="days-from-date('2010-12-31')">
   <xforms:label>Days-from-date 2010-12-31 : </xforms:label>
</xforms:output>

The above example returns "14974".

Specification

Link to the XForms specification: the days-from-date() function.