op:add-yearMonthDurations

Adds $yearMonthDuration-var1 to $yearMonthDuration-var2.

Signatures

op:add-yearMonthDurations(xf:yearMonthDuration $yearMonthDuration-var1, xf:yearMonthDuration $yearMonthDuration-var2) —> xf:yearMonthDuration

Arguments

Data Type
Argument
Description

xf:yearMonthDuration

$yearMonthDuration-var1

Contains a time duration that can contain years and months.

xf:yearMonthDuration

$yearMonthDuration-var2

Contains a time duration that can contain years and months.

Returns

Returns the yearMonthDuration value of adding $yearMonthDuration-var1 to $yearMonthDuration-var2.

Examples

Simple

The following example query adds a yearMonthDuration value equal to 1 year and 2 months to a yearMonthDuration value equal to 2 years and 11 months as shown in the following query:

<yearMonthDuration>{
	op:add-yearMonthDurations(xf:yearMonthDuration("P1Y2M"), xf:yearMonthDuration("P2Y11M"))
}</yearMonthDuration> 

The resulting yearMonthDuration value of 4 years and 1 month is returned as shown in the following result:

<yearMonthDuration>P4Y1M</yearMonthDuration> 

Related Topics

W3C add-yearMonthDurations operator description.

W3C yearMonthDuration description.

xf:yearMonthDuration constructor description.