The seconds() Function

Release 2.0 - ...

Syntax

  CopyCode image Copy Code
number seconds(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:duration, the return value is equal to the number specified in the seconds component plus 60 * the number specified in the minutes component, plus 60 * 60 * the number specified in the hours component, plus 60 * 60 * 24 * the number specified in the days component. The sign of the result will match the sign of the duration. Year and month components, if present, are ignored. Any other input parameter causes a return value of NaN.

Example

XML CopyCode image Copy Code
<xforms:output value="seconds('P3DT10H30M1.5S')">
   <xforms:label>Result : </xforms:label>
</xforms:output>

The above example returns "297001,5".

Specification

Link to the XForms specification: the seconds() function.