op:add-dayTimeDuration-to-dateTime

Adds $dayTimeDuration-var to the date and time specified by $dateTime-var.

Signatures

op:add-dayTimeDuration-to-dateTime(xs:dateTime $dateTime-var, xf:dayTimeDuration $dayTimeDuration-var) —> xs:dateTime

Arguments

Data Type
Argument
Description

xs:dateTime

$dateTime-var

Contains a representation of the date and time.

xf:dayTimeDuration

$dayTimeDuration-var

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

Returns

Returns the dateTime result of adding the date and time specified by $dayTimeDuration-var to date and time specified by $dateTime-var. The returned dateTime value has the same timezone as $dateTime-var. If $dateTime-var has no timezone, then the returned dateTime value has the no timezone.

Examples

Simple

The following example query adds a dayTimeDuration value equal to 1 day, 2 hours, 30 minutes, and 5 seconds to a dateTime value equal to the date: January 1, 2003 and time: 1:00 AM as shown in the following query:

<dateTime>{
	op:add-dayTimeDuration-to-dateTime(xs:dateTime("2003-01-01T01:00:00"), xf:dayTimeDuration("P1DT2H30M5S"))
}</dateTime> 

The resulting dateTime value equal to the date: January 2, 2003 and the time: 3:30:05 AM is returned as shown in the following result:

<dateTime>2003-01-02T03:30:05</dateTime> 

Related Topics

W3C add-dayTimeDuration-to-dateTime operator description.

W3C dayTimeDuration description.

xf:dayTimeDuration constructor description.

W3C dateTime data type description

xs:dateTime constructor description.