Subtracts the value of $yearMonthDuration-var2 from $yearMonthDuration-var1.
op:subtract-yearMonthDurations(xf:yearMonthDuration $yearMonthDuration-var1, xf:yearMonthDuration $yearMonthDuration-var2) —> xf:yearMonthDuration
Returns the yearMonthDuration value of subtracting $yearMonthDuration-var2 from $yearMonthDuration-var1.
The following example query subtracts a yearMonthDuration value equal to 1 year and 1 month from a yearMonthDuration value equal to 3 years and 3 months as shown in the following query:
<positive>{ op:subtract-yearMonthDurations(xf:yearMonthDuration("P3Y3M"), xf:yearMonthDuration("P1Y1M")) }</positive>
The resulting positive yearMonthDuration value of 2 years and 2 months is returned as shown in the following result:
<positive>P2Y2M</positive>
The following example query subtracts a yearMonthDuration value equal to 3 years and 3 months from a yearMonthDuration value equal to 1 year and 1 month as shown in the following query:
<negative>{ op:subtract-yearMonthDurations(xf:yearMonthDuration("P1Y1M"), xf:yearMonthDuration("P3Y3M")) }</negative>
The resulting negative yearMonthDuration value of 2 years and 2 months is returned as shown in the following result:
<negative>-P2Y2M</negative>
W3C subtract-yearMonthDurations operator description.
W3C yearMonthDuration description.
xf:yearMonthDuration constructor description.