Addmonth

addmonth allows you to add a given number of months to a date.

Syntax

 addmonth( DATE_EXPR, INTEGER_EXPR )

Examples

 # Previous monthPREV_MONTH = addmonth(date$,-1)# Next yearNEXT_YEAR = addmonth(date$,12)# End of monthNEXT_MONTH = addmonth([31/01/2013],1) : # Returns [28/2/2013]# What will be the day in one month ?DAY_NAME = day$(addmonth(date$,1))# Due date computationDUE_DATE = addmonth(gdat$(INVOICE_DAY,INVOICE_MONTH,INVOICE_YEAR),DELAY)

Description

The function addmonth adds a number of months to a date. The number of months can be positive or negative and be greater than 12 (the year will be increased if necessary).

If the date value has a day number that is over the number of days for the result month, the last day of the month is returned.

The type of result is Date.

Associated errors

Error codeDescription
10One of the arguments has an incorrect type.
56Incorrect date.

See also

day, day$, month$, year, dayn, nday, nday$, date$, datesyst, gdat$, eomonth.