# EXSLT - date:seconds - Implementer Page

Version: 1 Status: implemented User Page: index.html XML Definition: date.seconds.xml Function Package: date.seconds.zip #### Function Syntax
    number date:seconds(string?)
The `date:seconds` function returns the number of seconds specified by the argument string. If no argument is given, then the current local date/time, as returned by `date:date-time` is used as a default argument. The argument string may be in one of the following formats: A right-truncated date/time string in one of the formats defined in [XML Schema Part 2: Datatypes]. In these cases, the difference between the date/time string and 1970-01-01T00:00:00Z is calculated as with `date:difference` and the result is converted to seconds with `date:seconds`. The legal formats are as follows: `xs:dateTime` (`CCYY-MM-DDThh:mm:ss`) `xs:date` (`CCYY-MM-DD`) `xs:gYearMonth` (`CCYY-MM`) `xs:gYear` (`CCYY`) A duration specified in days, hours, minutes and seconds in the format defined for `xs:duration` in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. The number of years and months in the duration string must both be equal to zero: either `P0Y0M120D` or `P120D` are permitted, but `P3M` is not. If the argument to `date:seconds` is defined as a duration, the number returned is the result of converting the duration to seconds by assuming that 1 day = 24 hours, 1 hour = 60 minutes and 1 minute = 60 seconds. The permitted duration format is basically `PnDTnHnMnS`, although implementers should consult [XML Schema Part 2: Datatypes] and [ISO 8601] for details. If the argument is not in any of these formats, `date:seconds` returns `NaN`. An implementation of this extension function in the EXSLT date namespace must conform to the behaviour described in this document. ## Implementations Built-in support for `date:seconds` is available in the following XSLT processors:
Processor | Processor Version | Implemented Version
--- | --- | ---
libxslt from Daniel Veillard et al. | 1.0.19 | 1
The following implementations of `date:seconds` are available:
Language | Implemented Version | Creator | Date | Download
--- | --- | --- | --- | ---
Javascript | 1 | Chris Bayes | 2001-06-11 | date.js
Msxsl | 1 | Chris Bayes | 2001-06-16 | date.msxsl.xsl
## Change History Submitted: 2001-05-12 Creator: Jeni Tennison(http://www.jenitennison.com/) Returns the result of converting the argument to a number of seconds, or current date/time in seconds since 1970-01-01T00:00:00Z.
Version | Modified | By | Details
--- | --- | --- | ---
1.1 | 2001-06-11 | Jeni Tennison | Added Javascript implementation.
1.2 | 2001-06-16 | Jeni Tennison | Updated Javascript implementation. Added Microsoft-specific stylesheet.
1.3 | 2002-08-21 | Craig Stewart | Added libxslt implementation to the list.

http://www.exslt.org/date/functions/seconds/date.seconds.html last modified 2002-08-21