Loading TOC...

MarkLogic 10 Product Documentation
cts:period-compare

cts:period-compare(
   $period-1 as cts:period,
   $operator as xs:string,
   $period-2 as cts:period
) as xs:boolean

Summary

Compares two periods using the specified comparison operator. Returns true if the two periods meet the operator conditions or false if they do not meet the conditions.

Parameters
period-1 The first period to compare.
operator A comparison operator.
period-2 The second period to compare against the first.

Example

xquery version "1.0-ml";

let $period1 := cts:period(xs:dateTime("2000-05-31T09:30:10-08:00"),
                           xs:dateTime("2003-05-31T09:30:10-08:00"))

let $period2 := cts:period(xs:dateTime("2003-05-31T09:30:10-08:00"), 
                           xs:dateTime("2004-05-31T09:30:10-08:00"))

return cts:period-compare($period1,"aln_meets",$period2)

  => true

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