op:add-yearMonthDuration-to-dateTime

Adds $yearMonthDuration-var to the date and time specified by $dateTime-var.

Signatures

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

Arguments

Data Type
Argument
Description

xs:dateTime

$dateTime-var

Contains a representation of the date and time.

xf:yearMonthDuration

$yearMonthDuration-var

Contains a time duration that can contain years and months.

Returns

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

Examples

Simple

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

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

The resulting dateTime value equal to the date: February 1, 2004 and the time: 1:00 AM is returned as shown in the following result:

<dateTime>2004-02-01T01:00:00</dateTime> 

Related Topics

W3C add-yearMonthDuration-to-dateTime operator description.

W3C yearMonthDuration description.

xf:yearMonthDuration constructor description.

W3C dateTime data type description

xs:dateTime constructor description.