I have forgotten

• https://me.yahoo.com
COST (GBP)
3.12
6.68
0

# inc Month

Advances a serial date by a number of \a Months. Excel: EDATE
Controller: CodeCogs
Contents

C++

## IncMonth

 intincMonth( int nDate int months calendar dateSystem` = cal_Gregorian` )[inline]
Returns the serial Julian date which equals nDate plus or minus the the specified number of months.

The month is modified using: $\inline&space;&space;Month_{new}&space;=&space;Month_{old}&space;+&space;Months$. In circumstances where the new date has too many days for the month, the number of days are reduced to accommodate the month. For example: edate("30/March/2004", -1) is 29 February 2004.

### Example 1

```#include <stdio.h>
#include <codecogs/units/date/incmonth.h>
#include <codecogs/units/date/date.h>
#include <codecogs/units/date/dateymd.h>
using namespace Units::Date;

int main()
{
for(int i=-12; i<=12; i++)
{
int d,m,y;
dateYMD(incMonth(date("31,dec,2004"), i), y, m, d);
printf("\n incMonth(date(\"31,dec,2004\"),%d)= %2d-%2d-%d",i, d, m, y);
}
return 0;
}```

### Output

```19 February 2003 + -4 months is: 19-10-2002
19 February 2003 + -3 months is: 19-11-2002
19 February 2003 + -2 months is: 19-12-2002
19 February 2003 + -1 months is: 19-1-2003
19 February 2003 + 0 months is: 19-2-2003
19 February 2003 + 1 months is: 19-3-2003
19 February 2003 + 2 months is: 19-4-2003
19 February 2003 + 3 months is: 19-5-2003
19 February 2003 + 4 months is: 19-6-2003```

### Parameters

 nDate is the number of days from 24 November 4714 BC - otherwise known as the Julian Period (also 1 January 4713BC in the Julian Calendar). months are the number of months to add (a positive value) or subtract (a negative value) from nDate. dateSystem selects which date system should be used (see constants).

### Authors

Will Bateman (Sep 2004)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.