op:subtract-dayTimeDuration-from-time

Subtracts the time duration specified by $dayTimeDuration-var from the time specified by $time-var.

Signatures

op:subtract-dayTimeDuration-from-time(xs:time $time-var, xf:dayTimeDuration $dayTimeDuration-var) —> xs:time

Arguments

Data Type
Argument
Description

xs:time

$time-var

Contains a representation of the time.

xf:dayTimeDuration

$dayTimeDuration-var

Contains a time duration that can contain days, hours, minutes, and seconds.

Returns

Returns the time value of subtracting the time duration specified by $dayTimeDuration-var from the date and time specified by $time-var.

Examples

Subtracting a Positive dayTimeDuration

The following example query subtracts a positive dayTimeDuration value equal to 1 day and 1 minute from a time value equal to the time: 1:01 AM as shown in the following query:

<positive>{
	op:subtract-dayTimeDuration-from-time(xs:time("01:01:00"), xf:dayTimeDuration("P1DT1M"))
}</positive> 

The resulting time value equal to the time: 1:00 AM is returned as shown in the following result:

<positive>01:00:00</positive> 

Subtracting a Negative dayTimeDuration

The following example query subtracts a negative dayTimeDuration value equal to 1 day and 1 minute from a time value equal to the time: 1:01 AM as shown in the following query:

<negative>{
	op:subtract-dayTimeDuration-from-time(xs:time("01:01:00"), xf:dayTimeDuration("-P1DT1M"))
}</negative> 

The resulting time value equal to the time: 1:02 AM is returned as shown in the following result:

<negative>01:02:00</negative> 

Related Topics

W3C subtract-dayTimeDuration-from-time operator description.

W3C dayTimeDuration description.

xf:dayTimeDuration constructor description.

W3C time data type description

xs:time constructor description.