XPath/XQuery subtract-yearMonthDuration-from-dateTime function

Summary

Returns the xs:dateTime that is a given duration before a specified xs:dateTime (or after, if the duration is negative).

Operator Mapping

Defines the semantics of the "-" operator when applied to an xs:dateTime and an xs:yearMonthDuration value.

Signature

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

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

The function returns the xs:dateTime computed by negating $arg2 and adding the result to the value of $arg1 using the function op:add-yearMonthDuration-to-dateTime.

Examples

The expression op:subtract-yearMonthDuration-from-dateTime(xs:dateTime("2000-10-30T11:12:00"), xs:yearMonthDuration("P1Y2M")) returns xs:dateTime("1999-08-30T11:12:00").