# EXSLT - date:add-duration - Implementer Page

Version: 2 Status: implemented User Page: index.html XML Definition: date.add-duration.xml Function Package: date.add-duration.zip #### Function Syntax
    string date:add-duration(string, string)
#### Template Syntax
    <xsl:call-template name="date:add-duration">
       <xsl:with-param name="duration1" select="string" />
       <xsl:with-param name="duration2" select="string" />
    </xsl:call-template>
The `date:add-duration` function returns the duration resulting from adding two durations together. Both arguments are strings in the format defined for `xs:duration` in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. If either argument is not in this format, the function returns an empty string (`''`). The return value is a string in the format defined for `xs:duration` in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. The durations can usually be added by summing the numbers given for each of the components in the durations. However, if the durations are differently signed, then this sometimes results in durations that are impossible to express in this syntax (e.g. `'P1M'` + `'-P1D'`). In these cases, the function 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:add-duration` is available in the following XSLT processors:
Processor | Processor Version | Implemented Version
--- | --- | ---
libxslt from Daniel Veillard et al. | 1.0.19 | 2
The following implementations of `date:add-duration` are available:
Language | Implemented Version | Creator | Date | Download
--- | --- | --- | --- | ---
EXSLT Function | 2 | Jeni Tennison | 2001-06-11 | date.add-duration.function.xsl
XSLT Template | 2 | Jeni Tennison | 2001-06-11 | date.add-duration.template.xsl
Javascript | 2 | Chris Bayes | 2001-06-11 | date.js
Msxsl | 2 | Chris Bayes | 2001-06-16 | date.msxsl.xsl
## Change History Previous Version: date.add-duration.1.html
Version | Modified | By | Details
--- | --- | --- | ---
2 | 2001-06-11 | Jeni Tennison | Made it illegal to have an addition result in positive (years and) months and negative (days, hours, minutes and) seconds, or vice versa. Added implementations in Javascript, XSLT and EXSLT - Functions.
2.1 | 2001-06-16 | Jeni Tennison | Updated Javascript implementation. Added Microsoft-specific stylesheet.
2.2 | 2002-08-21 | Craig Stewart | Added libxslt implementation to the list.

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