EXSLT - date:seconds - Version 1

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:

  1. 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:

  2. 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:

ProcessorProcessor VersionImplemented Version
libxslt from Daniel Veillard et al.1.0.191

The following implementations of date:seconds are available:

LanguageImplemented VersionCreatorDateDownload
Javascript1Chris Bayes2001-06-11date.js
Msxsl1Chris Bayes2001-06-16date.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.

VersionModifiedByDetails
1.12001-06-11Jeni Tennison

Added Javascript implementation.

1.22001-06-16Jeni Tennison
  • Updated Javascript implementation.
  • Added Microsoft-specific stylesheet.
1.32002-08-21Craig Stewart

Added libxslt implementation to the list.

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