The seconds-from-dateTime() Function

Release 2.0 - ...

Syntax

  CopyCode image Copy Code
number seconds-from-dateTime(string)

Description

This function returns a possibly fractional number of seconds, according to the following rules:

  • If the string parameter represents a legal lexical xsd:dateTime, the return value is equal to the number of seconds difference between the specified dateTime (normalized to UTC) and 1970-01-01T00:00:00Z.
    If no time zone is specified, UTC is used. Any other input string parameter causes a return value of NaN.
    This function does not support leap seconds.

Example

XML CopyCode image Copy Code
<xforms:output value="seconds-from-dateTime('1971-01-01T00:00:00Z')">
   <xforms:label>seconds-from-dateTime : </xforms:label>
</xforms:output>

The above example returns "31536000".

Specification

Link to the XForms specification: the seconds-from-dateTime() function.