Skip to main content
Version: Next

addToDate

addToDate ( aDate : date , years : integer , months : integer , days : integer) : date

ParameterTypeDescription
aDatedateDate to which to add days, months, and years
yearsintegerNumber of years to add to the date
monthsintegerNumber of months to add to the date
daysintegerNumber of days to add to the date
ResultdateResulting date

Description

The addToDate command adds years, months, and days to the date you pass in aDate, then returns the result.

addToDate allows you to quickly add months and years without having to deal with the number of days per month or leap years (as you would when using the + date operator).

Example

 var vdInOneYear, vdNextMonth, vdTomorrow : date

// This line calculates the date in one year, same day
vdInOneYear = addToDate(currentDate,1,0,0)

// This line calculates the date next month, same day
vdNextMonth = addToDate(currentDate,0,1,0)

// This line does the same thing as vdTomorrow = currentDate+1
vdTomorrow = addToDate(currentDate,0,0,1)