Calculating a future date
add[Unit](duration)
Can be used with dates to calculate a future date
The units supported are:
- Days
addDays()
e.g.node.startDate.addDays(100)
adds 100 days to start date - Weeks
addWeeks()
e.g.node.startDate.addWeeks(26)
adds 26 weeks to start date - Months
addMonths()
e.g.node.startDate.addMonths(3)
adds 3 months to start date - Quarters
addQuarters()
e.g.node.startDate.addQuarters(1)
adds 1 quarter to start date - Years
addYears()
e.g.node.startDate.addYears(15)
adds 15 years to start date
Note: The time unit must be capitalised as shown above e.g.
addMonths()
Calculate a service anniversary
To calculate what date in the future a 15 year service anniversary will fall on, based on Start Date, use addYears(15)
in the expression
node.startDate.addYears(15)
How long until a future date
The add[Unit](duration)
function can be used along with dateDiff() to calculate how far away a future date is
In this example the expression will return the number of days from today until the 15 year anniversary of start date
node.startDate.addYears(15).dateDiff(today())