1. Главная
  2. Функции XPath
  3. date:add()

date:add XPath

The date:add function returns the date/time resulting from adding a duration to a date/time.

Синтаксис

EXSLT Function Syntax

string date:add(string, string)

EXSLT Template Syntax

<xsl:call-template name="date:add">
   <xsl:with-param name="date-time" select="string" />
   <xsl:with-param name="duration" select="string" />
</xsl:call-template>

Описание и примеры

The first argument must be right-truncated date/time strings in one of the formats defined in XML Schema Part 2: Datatypes. The permitted formats are as follows:

xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
xs:gYearMonth (CCYY-MM)
xs:gYear (CCYY) 

The second argument is a string in the format defined for xs:duration in 3.2.6 duration of XML Schema Part 2: Datatypes.

The return value is a right-truncated date/time strings in one of the formats defined in XML Schema Part 2: Datatypes and listed above. This value is calculated using the algorithm described in Appendix E Adding durations to dateTimes of XML Schema Part 2: Datatypes.

Implementations

The following XSLT processors support date:add:

  • 4XSLT, from 4Suite. (version 0.12.0a3)
  • libxslt from Daniel Veillard et al. (version 1.0.19)

Implementations of date:add are available in the following languages: