Loading TOC...

fn:subtract-dateTimes-yielding-yearMonthDuration

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

Summary

[0.9-ml only, use the minus operator ( - ) instead] Returns the xdt:yearMonthDuration 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, 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-yearMonthDuration(
  fn:current-dateTime(),
  xs:dateTime("2000-01-11T12:01:00.000Z"))
=> the yearMonthDuration P8Y10M, 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.