Loading TOC...

xs.date.subtract

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

Summary

Returns the difference between two xs.dates as an xs.dayTimeDuration. Returns the beginning of a time period by subtracting an xs.yearMonthDuration from the xs.datethat ends the period. Returns the beginning of a time period by subtracting an xs.dayTimeDuration from the xs.date that ends the period.

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

Example

const v1 = xs.date('2013-08-15');
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.