viewed 4616 times and licensed 75 times
Returns the number of days in the month of a Gregorian calendars.
Open Office: DAYSINMONTH
View version details
Contents  |
|
Interface
#include <codecogs/units/date/daysinmonth.h>
using namespace Units::Date;
| int | daysInMonth (int year, int month) Returns the number of days in the month of a Gregorian calendars.
Open Office: DAYSINMONTH |
 | Integer | cc_daysInMonth (Integer year, Integer month) This function is available as a Microsoft Excel add-in. |
Function Documentation
Returns the number of days in the months of a Gregorian calendar for the
month of
year. The year is used to apply adjustments for leap years.
Each month has a fixed number of days, except in a leap year, when February gains an extra day. Although we traditionally treat the 29th February as the leap day, a left over remnant of the Roman calendar means that the theoretical leap day occurs on the 24th February - many celebrations occur on this day for this reason.
The number of days in each month of the Gregorian / Julian calendar are:
| January | 31 |
| February | 28/29 |
| March | 31 |
| April | 30 |
| May | 31 |
| June | 30 |
| July | 31 |
| August | 31 |
| September | 30 |
| October | 31 |
| November | 30 |
| December | 31 |
Example 1:
- To output the number of days in each month of 1974
#include <stdio.h>
#include <codecogs/units/date/daysinmonth.h>
int main()
{
for(int i=1;i<=12;i++)
printf("\n Month %d has %d days",i , Units::Date::daysInMonth(2004,i));
return 0;
}
Parameters:
| year | can be any integer greater than 4800 BC (see isLeapYear). |
| month | can be any integer between 1 and 12 (inclusive). |
Authors:
- Will Bateman (Sep 2004)
Page Comments
You must login to leave a messge
Last Modified: 18 Oct 07 @ 17:07 Page Rendered: 2010-03-13 14:39:09