📅 Days in Month Calculator
By ToolNimba Editorial Team · Updated 2026-06-19
Pick a month and year to see how many days it has.
| Month | Days |
|---|
This days in month calculator tells you exactly how many days are in any month of any year. Pick a month from the list, type a year, and it shows the day count straight away, along with whether that year is a leap year and a full table of all 12 months. It is handy for planning, payroll, billing cycles, and settling the eternal question of how many days February has this year.
What is the Days in Month Calculator?
Most months have a fixed length that never changes: seven months have 31 days (January, March, May, July, August, October and December) and four months have 30 days (April, June, September and November). February is the only month whose length depends on the year, holding 28 days in a common year and 29 days in a leap year. That single exception is the reason a calculator is useful at all, since everything else can be memorised with the old knuckle trick or the rhyme that begins thirty days has September.
The leap year rule exists because a year is not exactly 365 days long. The Earth takes about 365.2422 days to orbit the Sun, so a 365-day calendar drifts by almost a quarter of a day each year. To correct this, the Gregorian calendar adds a leap day to February every four years, but with two refinements: a year divisible by 100 is not a leap year unless it is also divisible by 400. So 2000 was a leap year, 1900 was not, and 2100 will not be either. The full rule is: a year is a leap year if it is divisible by 4 and either not divisible by 100, or divisible by 400.
Under the hood, this tool uses a reliable date trick rather than a lookup table. Asking for day zero of the following month, written as new Date(year, month, 0) in JavaScript, rolls back to the last day of the month you actually want, and reading that day number gives the length. Because the browser computes February using the real Gregorian leap rule, the answer is always correct for the year you enter, with no special cases to maintain.
When to use it
- Settling how many days February has in a given year, especially around leap years.
- Working out billing or subscription cycles that depend on the exact number of days in a month.
- Calculating a daily rate for rent, salary, or interest by dividing a monthly figure by the real day count.
- Planning project schedules or content calendars where you need each month length at a glance.
How to use the Days in Month Calculator
- Choose the month you want from the dropdown list.
- Type the year (for example 2026) into the year field.
- Read off the number of days in that month and whether the year is a leap year.
- Scan the 12-month table to compare every month in the chosen year at once.
Formula & method
Worked examples
How many days are in February 2024?
- Check the leap rule: 2024 mod 4 = 0, and 2024 mod 100 = 24 (not 0), so 2024 is a leap year.
- In a leap year February holds 29 days rather than 28.
- The tool confirms this with new Date(2024, 2, 0).getDate() = 29.
Result: February 2024 has 29 days.
How many days are in February 1900?
- Apply the leap rule: 1900 mod 4 = 0, so the basic test passes.
- But 1900 mod 100 = 0 and 1900 mod 400 = 300 (not 0), so the century exception applies.
- A century year that is not divisible by 400 is a common year, so February has 28 days.
Result: February 1900 had 28 days, not 29.
How many days are in April 2026?
- April is one of the four 30-day months (April, June, September, November).
- Its length does not depend on the year, so no leap check is needed.
- new Date(2026, 4, 0).getDate() = 30 confirms it.
Result: April 2026 has 30 days.
Number of days in each month
| Month | Days | Notes |
|---|---|---|
| January | 31 | Fixed |
| February | 28 or 29 | 29 in a leap year, otherwise 28 |
| March | 31 | Fixed |
| April | 30 | Fixed |
| May | 31 | Fixed |
| June | 30 | Fixed |
| July | 31 | Fixed |
| August | 31 | Fixed |
| September | 30 | Fixed |
| October | 31 | Fixed |
| November | 30 | Fixed |
| December | 31 | Fixed |
Is the year a leap year? February day count for sample years
| Year | Leap year? | Days in February |
|---|---|---|
| 2023 | No | 28 |
| 2024 | Yes | 29 |
| 2025 | No | 28 |
| 2000 | Yes (divisible by 400) | 29 |
| 1900 | No (century, not by 400) | 28 |
| 2100 | No (century, not by 400) | 28 |
Common mistakes to avoid
- Assuming February always has 28 days. February gains a 29th day in every leap year, which is roughly one year in four. Treating it as always 28 days throws off any daily rate or schedule that falls in a leap February.
- Thinking every fourth year is a leap year. The divisible-by-4 rule has a century exception. Years like 1700, 1800, 1900 and 2100 are divisible by 4 but are not leap years because they are not divisible by 400. The year 2000 is the rare century that is.
- Off-by-one month numbering. In JavaScript the Date month argument is zero-based for normal use, but the day-zero trick new Date(year, month, 0) deliberately uses a one-based month. Mixing the two conventions gives the wrong month length.
- Confusing days in a month with days in a billing period. A billing cycle that runs from the 15th to the 14th spans parts of two months, so its length is not the same as any single calendar month. Use a date difference calculator for spans that cross a month boundary.
Glossary
- Leap year
- A year with 366 days, where February has 29 days instead of 28, added to keep the calendar aligned with the Earth orbit.
- Common year
- An ordinary 365-day year in which February has 28 days.
- Gregorian calendar
- The calendar in worldwide civil use today, introduced in 1582, which defines the modern leap year rule.
- Century year
- A year ending in 00, such as 1900 or 2000, which is a leap year only when it is divisible by 400.
- Month index
- A number identifying a month. This tool uses 1 for January through 12 for December.
Frequently asked questions
How many days are in a month?
It depends on the month. Seven months have 31 days (January, March, May, July, August, October, December), four months have 30 days (April, June, September, November), and February has 28 days in a common year or 29 days in a leap year.
How many days are in February?
February has 28 days in most years and 29 days in a leap year. Leap years occur roughly every four years, so February gains its extra day about once every four years.
How do I know if a year is a leap year?
A year is a leap year if it is divisible by 4, except for century years (those ending in 00), which must also be divisible by 400. So 2024 and 2000 are leap years, while 2023, 1900 and 2100 are not.
Why does February have a different number of days?
A solar year is about 365.2422 days, so a fixed 365-day calendar drifts. Adding a leap day to February every four years (with the century adjustments) keeps the calendar in step with the seasons.
Which months have 30 days and which have 31?
April, June, September and November have 30 days. January, March, May, July, August, October and December have 31 days. February is the only variable month, with 28 or 29 days.
How does this calculator work out the day count?
It asks the browser for day zero of the next month using new Date(year, month, 0), which rolls back to the last day of the month you chose. Reading that day number gives the exact length, including the correct February value for leap years.