Or login with:
| intendOfMonth( | int | nDate | |
| int | months | ||
| calendar | dateSystem = cal_Gregorian | )[inline] |
#include <stdio.h> #include <codecogs/units/date/endofmonth.h> #include <codecogs/units/date/date.h> using namespace Units::Date; int main() { for(int i=-2; i<=2; i++) { int d,m,y; dateYMD(endOfMonth(date("19,feb,2003"), i), y, m, d); printf("\n Month end for 19 February 2003 + %d months is: %d-%d-%d",i, d, m, y); } for(int i=-2; i<=2; i++) { int d,m,y; dateYMD(endOfMonth(date("31,dec,2004"), i), y, m, d); printf("\n Month end for 31 December 2004 + %d months is: %d-%d-%d",i, d, m, y); } return 0; }Output:
Month end for 19 February 2003 + -2 months is: 31-12-2002 Month end for 19 February 2003 + -1 months is: 31-1-2003 Month end for 19 February 2003 + 0 months is: 28-2-2003 Month end for 19 February 2003 + 1 months is: 31-3-2003 Month end for 19 February 2003 + 2 months is: 30-4-2003 Month end for 31 December 2004 + -2 months is: 31-10-2004 Month end for 31 December 2004 + -1 months is: 30-11-2004 Month end for 31 December 2004 + 0 months is: 31-12-2004 Month end for 31 December 2004 + 1 months is: 31-1-2005 Month end for 31 December 2004 + 2 months is: 28-2-2005
| 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): |
Source code is available when you buy a Commercial licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.
You must login to leave a messge