Loading TOC...

MarkLogic 10 Product Documentation
fn:subtract-dateTimes-yielding-dayTimeDuration

fn:subtract-dateTimes-yielding-dayTimeDuration(
   $srcval1 as xs:dateTime,
   $srcval1 as xs:dateTime
) as xdt:dayTimeDuration

Summary

[0.9-ml only, use the minus operator ( - ) instead] Returns the xdt:dayTimeDuration that corresponds to the difference between the normalized value of $srcval1 and the normalized value of $srcval2. If either argument is the empty sequence, returns the empty sequence. If the normalized value of $srcval1 precedes in time the normalized value of $srcval2, then the returned value is a negative duration.

Parameters
srcval1 The first xs:dateTime value.
srcval1 The second xs:dateTime value.

Example

xquery version "0.9-ml"
fn:subtract-dateTimes-yielding-dayTimeDuration(
  fn:current-dateTime(),
  xs:dateTime("2000-01-11T12:01:00.000Z"))
=> the dayTimeDuration P3240DT14H49M46.37S, or
   whatever is correct for the current date

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.