ADDMONTH C-3

NAME

addmonth - add months to DATE value

SYNOPSIS

#include <cbase/dtypes.h>

DATE addmonth (d, m)

DATE d;

int m;

DESCRIPTION

This function adds the number of months specified by m to the date d and returns the resulting date. A negative m value subtracts that many months from the date. If the number of days in the resulting date is larger than the last day of that month, then the day is reset to the last day of that month.

01/31/81 + 1 month = 02/28/81

If m is a multiple of 12, that many years is added (or subtracted) from the date.

If closedate is the last day of any month, the following calculates the last day of the following month:

nextclose = addmonth (closedate+1, 1) - 1;

SEE ALSO

atodate(C-3), firstday(C-3)