Subtracts the time duration specified by $yearMonthDuration-var from the date specified by $date-var.
op:subtract-yearMonthDuration-from-date(xs:date $date-var, xf:yearMonthDuration $yearMonthDuration-var) —> xs:date
Contains a time duration which can contain years and months. |
Returns the date value of subtracting the time duration specified by $yearMonthDuration-var from the date specified by $date-var.
The following example query subtracts a positive yearMonthDuration value equal to 1 year and 1 month from a date value equal to the date: February 2, 2003 as shown in the following query:
<positive>{ op:subtract-yearMonthDuration-from-date(xs:date("2003-02-02"), xf:yearMonthDuration("P1Y1M")) }</positive>
The resulting date value equal to the date: January 2, 2002 is returned as shown in the following result:
<positive>2002-01-02</positive>
The following example query subtracts a negative yearMonthDuration value equal to 1 year and 1 month from a date value equal to the date: January 2, 2003 as shown in the following query:
<negative>{ op:subtract-yearMonthDuration-from-date(xs:date("2003-01-02"), xf:yearMonthDuration("-P1Y1M")) }</negative>
The resulting date value equal to the date: February 2, 2004 is returned as shown in the following result:
<negative>2004-02-02</negative>
W3C subtract-yearMonthDuration-from-date operator description.
W3C yearMonthDuration description.
xf:yearMonthDuration constructor description.
W3C date data type description
xs:date constructor description.