MarkLogic Server 11.0 Product Documentation
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);
Powered by MarkLogic Server | Terms of Use | Privacy Policy