Days in Month
Calculate the exact number of days in any month. Handles leap years, shows weekday info, and validates February edge cases instantly.
About
Determining the number of days in a given month requires accounting for the irregular Gregorian calendar structure and leap year rules. February presents the primary complexity: it contains 28 days in common years but 29 days when the year satisfies the leap year condition (Y divisible by 4, except century years not divisible by 400). Miscounting days causes scheduling errors, contract disputes, and incorrect interest calculations in financial systems. This calculator implements the Gregorian leap year algorithm and returns precise day counts for any month between year 1 and 9999.
The tool also reports which weekday the month starts and ends on, useful for payroll processing and deadline planning. Note: the proleptic Gregorian calendar is used for dates before 1582, which may differ from historical Julian calendar records.
Formulas
The number of days in a month is computed by finding the last valid date of that month. JavaScript's Date constructor interprets day 0 as the last day of the previous month:
Where D = days in month, Y = year, M = zero-indexed month (0 = January).
Leap year determination follows the Gregorian rule:
Where L = TRUE if leap year, FALSE otherwise.
Reference Data
| Month | Days (Common Year) | Days (Leap Year) | Quarter |
|---|---|---|---|
| January | 31 | 31 | Q1 |
| February | 28 | 29 | Q1 |
| March | 31 | 31 | Q1 |
| April | 30 | 30 | Q2 |
| May | 31 | 31 | Q2 |
| June | 30 | 30 | Q2 |
| July | 31 | 31 | Q3 |
| August | 31 | 31 | Q3 |
| September | 30 | 30 | Q3 |
| October | 31 | 31 | Q4 |
| November | 30 | 30 | Q4 |
| December | 31 | 31 | Q4 |