Show 

AddMonths()

See Also  

Related Topics

 

 

Description

AddMonths() adds a number of months to a date.

 

 

Syntax

AddMonths(date,months)

 

 

Parameters

date

A date to which you want to add one or more months.

 

months

The number of months to add. A positive value adds months. A negative value subtracts.

 

 

Return Value

A date that is the same day of the month a specified number of months into the future.

 

 

Examples

AddMos(instrument)=begin

i = 1

exp = instrument.expire

retval = instrument.date

 

while retval < exp begin

retval = AddMonths(ddate,i)

i = i + 1

end

retval

end

 

This example returns the current day of the month one month prior to expiration.

 

 

Comments

AddMonths() will round the day down if necessary. i.e., AddMonth(8/31/02,1) will return 9/30/02 since September only has 30 days.