# EXSLT - date:seconds

Implementer Page: date.seconds.html 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`. ## Implementations The following XSLT processors support `date:seconds`: libxslt from Daniel Veillard et al. (version 1.0.19) Implementations of `date:seconds` are available in the following languages: Javascript (by Chris Bayes) Msxsl (by Chris Bayes)

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