FUNCTION
daysInMonth
Returns the number of days in the month of a Gregorian calendars. <span align="right" style="background-color:9999FF"><strong>Open Office: DAYSINMONTH</strong></span>
Interface
#include <codecogs/units/date/daysinmonth.h>
using namespace Units::Date;
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: <div style="margin-left:100"> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="100"> January</td><td width="50">31</td></tr> <tr><td> February</td><td>28/29</td></tr> <tr><td> March</td><td>31</td></tr> <tr><td> April</td><td>30</td></tr> <tr><td> May</td><td>31</td></tr> <tr><td> June</td><td>30</td></tr> <tr><td> July</td><td>31</td></tr> <tr><td> August</td><td>31</td></tr> <tr><td> September</td><td>30</td></tr> <tr><td> October</td><td>31</td></tr> <tr><td> November</td><td>30</td></tr> <tr><td> December</td><td>31</td></tr> </tr> </table> </div>
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
Interactive Calculator
Computing…
Set a range above first to export a graph.