Days in Month Calculator

Days in Month Calculator

Popular AI Skill PRO

Enter Calculation

Formula

Days(February)={29,if Leap28,otherwisewhere{Leap=(Yearmod4=0)and(Yearmod100≠0orYearmod400=0)\begin{gathered} \text{Days}\left(\text{February}\right) = \begin{cases} 29, & \text{if Leap} \\ 28, & \text{otherwise} \end{cases} \\[1.5em] \text{where}\quad \left\{ \begin{aligned} \text{Leap} &= \left(\text{Year} \bmod 4 = 0\right) \;\text{and} \\ &\quad\; \left(\text{Year} \bmod 100 \neq 0 \;\text{or}\; \text{Year} \bmod 400 = 0\right) \end{aligned} \right. \end{gathered}
Usage stats

Advertisement

Results

Days in This Month
29
days
Leap year? Yes

Report an error on this page

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.

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\).

Advertisement

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.

Last updated:

Most popular in Time and Date

View all Time and Date calculators