What Is the Days in Month Calculator?
This calculator tells you exactly how many days are in any month of any year. Most months are fixed — January always has 31 days, April always has 30 — but February changes between 28 and 29 days depending on whether the year is a leap year. This tool resolves that for you instantly using the proper Gregorian leap-year rules.
How to Use It
Select the month from the dropdown, type the year, and submit. The result shows the number of days in that month and whether the chosen year is a leap year. Try February 2024 versus February 2023 to see the difference.
The Formula Explained
Each month has a fixed length stored in a lookup table: $$\text{days} = [31, 28+L, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]_{\,month-1}$$ indexed by \(month - 1\). The only variable is February, which gets a +1 leap day (\(L\)) when the year qualifies. A year is a leap year if it is divisible by 4, except century years (divisible by 100) which must also be divisible by 400: $$L = (y \bmod 4 = 0) \land (y \bmod 100 \neq 0 \lor y \bmod 400 = 0)$$ So 2000 was a leap year, but 1900 was not.
Worked Example
For February 2024: \(2024 \div 4 = 506\) with no remainder, and it is not a century year, so it is a leap year (\(L = 1\)). The table gives $$28 + 1 = 29 \text{ days}$$ For February 2023, \(L = 0\), giving 28 days.
Days in Each Month: Quick Reference
This table applies to the Gregorian calendar, the civil calendar used in most of the world. Only February changes between common years and leap years.
| Month | Number | Days (common year) | Days (leap year) |
|---|---|---|---|
| January | 1 | 31 | 31 |
| February | 2 | 28 | 29 |
| March | 3 | 31 | 31 |
| April | 4 | 30 | 30 |
| May | 5 | 31 | 31 |
| June | 6 | 30 | 30 |
| July | 7 | 31 | 31 |
| August | 8 | 31 | 31 |
| September | 9 | 30 | 30 |
| October | 10 | 31 | 31 |
| November | 11 | 30 | 30 |
| December | 12 | 31 | 31 |
Year totals: a common year has 365 days (7 months of 31, 4 months of 30, and February with 28). A leap year has 366 days because February gains one extra day (29).
Check: \(7 \times 31 + 4 \times 30 + 28 = 217 + 120 + 28 = 365\).
Leap Year Comparison: Example Years
In the Gregorian calendar, a year is a leap year if it is divisible by 4, except century years (divisible by 100), which must also be divisible by 400.
| Year | Divisible by 4? | Divisible by 100? | Divisible by 400? | Leap year? | Days in February |
|---|---|---|---|---|---|
| 1900 | Yes | Yes | No | No | 28 |
| 2000 | Yes | Yes | Yes | Yes | 29 |
| 2023 | No | No | No | No | 28 |
| 2024 | Yes | No | No | Yes | 29 |
| 2100 | Yes | Yes | No | No | 28 |
| 2400 | Yes | Yes | Yes | Yes | 29 |
Rule in short: leap if \(y \bmod 400 = 0\), or if \(y \bmod 4 = 0\) and \(y \bmod 100 \neq 0\). For example, 1900 is divisible by 100 but not by 400, so it is not a leap year, while 2000 is divisible by 400, so it is.
FAQ
Why does February have 29 days some years? A solar year is about 365.24 days, so an extra day is added roughly every four years to keep the calendar aligned with Earth's orbit.
Is 2100 a leap year? No. It is divisible by 100 but not by 400, so February 2100 will have 28 days.
Which months always have 31 days? January, March, May, July, August, October, and December.