XPath/XQuery subtract-yearMonthDurations function

Summary

Returns the result of subtracting one xs:yearMonthDuration value from another.

Operator Mapping

Defines the semantics of the "-" operator when applied to two xs:yearMonthDuration values.

Signature

op:subtract-yearMonthDurations(
$arg1 as xs:yearMonthDuration,
$arg2 as xs:yearMonthDuration
) as xs:yearMonthDuration

Rules

The function returns the result of subtracting the value of $arg2 from the value of $arg1. The result will be an xs:yearMonthDuration whose length in months is equal to the length in months of $arg1 minus the length in months of $arg2.

For handling of overflow, see .

Examples

The expression op:subtract-yearMonthDurations(xs:yearMonthDuration("P2Y11M"), xs:yearMonthDuration("P3Y3M")) returns xs:yearMonthDuration("-P4M").

Notes

Either duration (and therefore the result) may be negative.