Computes the time difference between $time-var1 and $time-var2. Subtracts the value of $time-var2 from $time-var1.
If the value of $time-var2 follows in time the value of $time-var1, then the returned value is a negative duration.
If the value of $date-var1 or $date-var2 is the empty sequence, the following error is displayed:
Error occurred while executing XQuery: Error loading the XQuery or XSLT for this method: Type error in function subtract-dates invocation: expected type [date@http://www.w3.org/2001/XMLSchema], given type empty
op:subtract-times(xs:time $time-var1, xs:time $time-var2) —> xs:dayTimeDuration
Returns the time difference between $time-var1 and $time-var2 as dayTimeDuration value.
The following example returns a positive number of minutes because $time-var2 precedes in time $time-var1:
<minutes>{xf:get-minutes-from-dayTimeDuration(op:subtract-times(xf:time("08:01:00"),
xf:time("08:00:00")))}</minutes>
The preceding query generates the following result:
<minutes>1</minutes>
The following example returns a negative number of days because $time-var2 follows in time $time-var1:
<minutes>{xf:get-minutes-from-dayTimeDuration(op:subtract-times(xf:time("08:00:00"), xf:time("08:01:00")))}</minutes>
The preceding query generates the following result:
<minutes>-1</minutes>
W3C subtract-times operator description.
W3C date data type description.
W3C dayTimeDuration operator description.