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? |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:add-months
( $date as xs:anyAtomicType? ,
$months as xs:integer ) as xs:date? {
xs:date($date) + functx:yearMonthDuration(0,$months)
} ; |
ExamplesXQuery 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:
|