Loading TOC...

MarkLogic Server 11.0 Product Documentation
xs.dateTime.subtract

xs.dateTime.subtract(
   value as xs.dateTime|xs.yearMonthDuration|xs.dayTimeDuration
) as xs.dayTimeDuration|xs.dateTime

Summary

Returns the difference between two xs.dateTimes as an xs.dayTimeDuration. Returns the beginning of a time period by subtracting an xs.yearMonthDuration from thexs.dateTime that ends the period. Returns the beginning of a time period by subtracting an xs.dayTimeDuration from the xs.dateTimethat ends the period.

Parameters
value A date time or year month duration or day time duration.

Example

const v1 = xs.dateTime(xs.date('2013-08-15'), xs.time('12:30:45-05:00'));
const v2 = xs.yearMonthDuration("P3Y3M");
v1.subtract(v2);

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