Loading TOC...

MarkLogic 10 Product Documentation
cts.periodCompare

cts.periodCompare(
   period-1 as cts.period,
   operator as String,
   period-2 as cts.period
) as 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

const period1 = cts.period(xs.dateTime("2000-05-31T09:30:10-08:00"),
                           xs.dateTime("2003-05-31T09:30:10-08:00"));
const period2 = cts.period(xs.dateTime("2003-05-31T09:30:10-08:00"), 
                           xs.dateTime("2004-05-31T09:30:10-08:00"));
cts.periodCompare(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.