EXSLT - date:duration - Implementer Page

Version: 1
Status: implemented
User Page: index.html
XML Definition: date.duration.xml
Function Package: date.duration.zip

Function Syntax

string date:duration(number?)

Template Syntax

<xsl:call-template name="date:duration">
   <xsl:with-param name="seconds" select="number" />?
</xsl:call-template>

The date:duration function returns a duration string representing the number of seconds specified by the argument string. If no argument is given, then the result of calling date:seconds without any arguments is used as a default argument.

The duration is returned as a string 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 be equal to zero. (The format of the string will be PnDTnHnMnS.) The number of seconds specified in the duration string must be less than 60; the number of minutes must be less than 60; the number of hours must be less than 24.

If the argument is Infinity, -Infinity or NaN, then date:duration returns an empty string ('').

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:duration is available in the following XSLT processors:

ProcessorProcessor VersionImplemented Version
libxslt from Daniel Veillard et al.1.0.191

The following implementations of date:duration are available:

LanguageImplemented VersionCreatorDateDownload
EXSLT Function1Jeni Tennison2001-05-12date.duration.function.xsl
XSLT Template1Jeni Tennison2001-05-12date.duration.template.xsl
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 number of seconds to a duration string, or the current date/time as a duration since 1970-01-01T00:00:00Z.

VersionModifiedByDetails
1.12001-06-11Jeni Tennison

Added Javascript implementation.

1.22001-06-12Jeni Tennison

Added implementations in XSLT and EXSLT - Functions.

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

Added libxslt implementation to the list.

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