Description
The functx:add-months function adds a specified number of months to a date. The $date argument must be castable to xs:date , meaning that it must have the type xs:date or xs:dateTime , or be an xs:string or untyped value of the form YYYY-MM-DD.
Arguments and Return TypeName | Type | Description |
$date |
xs:anyAtomicType? |
the date |
$months |
xs:integer |
the number of months to add |
return value |
xs:date? |
XSLT Function DeclarationSee XQuery definition. | <xsl:function name="functx:add-months" as="xs:date?"
xmlns:functx="http://www.functx.com">
<xsl:param name="date" as="xs:anyAtomicType?"/>
<xsl:param name="months" as="xs:integer"/>
<xsl:sequence select="
xs:date($date) + functx:yearMonthDuration(0,$months)
"/>
</xsl:function>
|
ExamplesXPath Example | Results |
---|
functx:add-months(xs:date('2004-01-23'),1) |
2004-02-23 |
functx:add-months(
xs:dateTime('2005-12-31T12:00:13'),2) |
2006-02-28 |
functx:add-months('2005-12-31',-3) |
2005-09-30 |
Depends OnSee AlsoHistory |
Recommended Reading:
|