AddYears()

See Also   

Related Topics

 

 

Description

AddYears() adds a number of years to a date.

 

 

Syntax

AddYears(date,years)

 

 

Parameters

date

The date to which you want to add one or more years.

 

years

A number representing the number of years you want to add. A positive value adds years. A negative value subtracts.

 

 

Return Value

A date that represents the sum of the date and the number of years.

 

 

Examples

AddYrs(instrument)=begin

n = Random(10)

retval = AddYears(instrument.date, n)

end

 

This example returns the current date n years from now, where n is a random number between 1 and 10.

 

 

Comments

AddYears() will round the day down if necessary. i.e., AddYears(2/29/02,1) will return 2/28/03 on leap years.