Days in a Month Calculator

Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/5/2026

The number of days in a month follows the Gregorian calendar: 31 days for January, March, May, July, August, October and December; 30 days for April, June, September and November; 28 or 29 days for February, depending on whether the year is a leap year.

Explanation

The length of months in the Gregorian calendar follows a fixed rule, except for February, whose length depends on a subtler leap-year rule. A year is a leap year (it has 366 days, with a February 29th) if its number is divisible by 4 — unless it's also divisible by 100, in which case it is NOT a leap year, unless it's also divisible by 400, in which case it is a leap year again. This special case explains why the year 2000 was a leap year (divisible by 400) while 1900 was not (divisible by 100, but not by 400) — a classic trap, even among people who know the general 'divisible by 4' rule well. This complex rule exists to correct a discrepancy: an actual solar year lasts about 365.2425 days, slightly less than 365.25 (which the 'divisible by 4' rule alone would give), and the exception for multiples of 100 that aren't multiples of 400 brings the calendar even closer to this real value over the long run. Without this correction, the calendar would gradually drift relative to the seasons over the centuries.

Example: February 1900

Inputs

Month: February. Year: 1900.

Calculation

1900 is divisible by 4 (1900 ÷ 4 = 475) but also by 100 (1900 ÷ 100 = 19), and 1900 is not divisible by 400 (1900 ÷ 400 = 4.75): so the year is not a leap year, despite meeting the first criterion.

Result

February 1900 has 28 days: 1900 was not a leap year.

Frequently asked questions

Why was the year 2000 a leap year while 1900 was not?

Because the full rule has three levels: divisible by 4 (leap year), unless divisible by 100 (not a leap year), unless divisible by 400 (leap year again). 1900 is divisible by 100 but not by 400, so it's not a leap year; 2000 is divisible by both 100 and 400, so it is a leap year. The next case of this kind will be the year 2100, which will not be a leap year.

How often does a leap year occur?

On average every 4 years, except for the three years out of every four centuries where the multiple-of-100 rule applies without the multiple-of-400 rule (like 1900, 2100, 2200, 2300). Over a 400-year period, there are therefore 97 leap years rather than 100, which brings the calendar's average length closer to the real length of the solar year.

Why does this rule exist exactly?

Because an actual solar year (the time it takes Earth to orbit the Sun) lasts about 365.2425 days, not exactly 365.25 days. Adding a day every 4 years with no exception would bring the calendar too close to 365.25 days per year; the exception for multiples of 100 (except 400) corrects this discrepancy and keeps the Gregorian calendar aligned with the seasons over the very long term.

Related resources

Similar calculators