op:add-yearMonthDuration-to-date

Adds $yearMonthDuration-var to the date specified by $date-var.

Signatures

op:add-yearMonthDuration-to-date(xs:date $date-var, xf:yearMonthDuration $yearMonthDuration-var) —> xs:date

Arguments

Data Type
Argument
Description

xs:date

$date-var

Contains a representation of the date.

xf:yearMonthDuration

$yearMonthDuration-var

Contains a time duration that can contain years and months.

Returns

Returns the date result of adding the year and month specified by $yearMonthDuration-var to date specified by $date-var. The returned date value has the same timezone as $date-var. If $date-var has no timezone, then the returned date value has the no timezone.

Examples

Simple

The following example query adds a yearMonthDuration value equal to 1 year and 1 month to a date value equal to the date: January 1, 2003 as shown in the following query:

<date>{
	op:add-yearMonthDuration-to-date(xs:date("2003-01-01"), xf:yearMonthDuration("P1Y1M"))
}</date> 

The resulting date value equal to the date: February 1, 2004 is returned as shown in the following result:

<date>2004-02-01</date> 

Related Topics

W3C add-yearMonthDuration-to-date operator description.

W3C yearMonthDuration description.

xf:yearMonthDuration constructor description.

W3C date data type description

xs:date constructor description.