XPath/XQuery subtract-dayTimeDuration-from-time function

Summary

Returns the xs:time value that is a given duration before a specified xs:time (or after, if the duration is negative or causes wrap-around past midnight)

Operator Mapping

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

Signature

op:subtract-dayTimeDuration-from-time(
$arg1 as xs:time,
$arg2 as xs:dayTimeDuration
) as xs:time

Properties

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

Rules

The function returns the result of negating $arg2 and adding the result to $arg1 using the function op:add-dayTimeDuration-to-time.

Examples

The expression op:subtract-dayTimeDuration-from-time(xs:time("11:12:00"), xs:dayTimeDuration("P3DT1H15M")) returns xs:time("09:57:00").

The expression op:subtract-dayTimeDuration-from-time(xs:time("08:20:00-05:00"), xs:dayTimeDuration("P23DT10H10M")) returns xs:time("22:10:00-05:00").