AddYearsToDate (open)
Adds a number of years to a date, and returns the new timestamp
Syntax
LOADLIB "wh::datetime.whlib";
DATETIME FUNCTION AddYearsToDate(INTEGER add_years, DATETIME date, RECORD options)Parameters
INTEGER add_yearsThe number of years to add to the timestamp. This value can also be negative.
DATETIME dateThe timestamp to add the days to
RECORD optionsOptions
BOOLEAN roundforwardRound up/forward towards next year. Defaults to TRUE
Return value
DATETIMEA DateTime value representing @italic date to which @italic add_years has been added
Description
This function can for example be useful to calculate expiration dates of documents or users.
Examples
// Add 5 years to the current date
INTEGER extrayears := 5;
DATETIME newdate := AddYearsToDate(extrayears, GetCurrentDateTime());