Connect via MCP →

Enter Calculation

Formula

Formula: Days in Month Calculator
Show calculation steps (1)
  1. Leap year test

    Leap year test: Days in Month Calculator

    L = 1 (Feb has 29 days) when the year is divisible by 4 but not 100, unless also divisible by 400.

Advertisement

Results

Days in This Month
29
days
Leap year? Yes

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.

Advertisement
Twelve month blocks each labeled with their number of days, February highlighted
Each month has a fixed day count except February, which gains a day in leap years.

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.

Flowchart of leap year rules leading to 28 or 29 day February
Leap year rule: divisible by 4, but not 100 unless also 400, gives February 29 days.

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.

Last updated: