User Rating 0.0
Total Usage 0 times
Category Time & Date
Select a month to check
Enter a year (1–9999)
Days in Month
Leap Year
First Day
Last Day
Is this tool helpful?

Your feedback helps us improve.

About

Determining the number of days in a given month requires accounting for the irregular Gregorian calendar structure and leap year rules. February presents the primary complexity: it contains 28 days in common years but 29 days when the year satisfies the leap year condition (Y divisible by 4, except century years not divisible by 400). Miscounting days causes scheduling errors, contract disputes, and incorrect interest calculations in financial systems. This calculator implements the Gregorian leap year algorithm and returns precise day counts for any month between year 1 and 9999.

The tool also reports which weekday the month starts and ends on, useful for payroll processing and deadline planning. Note: the proleptic Gregorian calendar is used for dates before 1582, which may differ from historical Julian calendar records.

days in month month length leap year calendar date calculator february days

Formulas

The number of days in a month is computed by finding the last valid date of that month. JavaScript's Date constructor interprets day 0 as the last day of the previous month:

D = Date(Y, M + 1, 0).getDate()

Where D = days in month, Y = year, M = zero-indexed month (0 = January).

Leap year determination follows the Gregorian rule:

L = (Y mod 4 = 0 Y mod 100 0) (Y mod 400 = 0)

Where L = TRUE if leap year, FALSE otherwise.

Reference Data

MonthDays (Common Year)Days (Leap Year)Quarter
January3131Q1
February2829Q1
March3131Q1
April3030Q2
May3131Q2
June3030Q2
July3131Q3
August3131Q3
September3030Q3
October3131Q4
November3030Q4
December3131Q4

Frequently Asked Questions

The Gregorian calendar adds a leap day to February when the year is divisible by 4, except for century years (divisible by 100) unless also divisible by 400. This corrects the ~0.2422-day annual drift between the calendar year (365 days) and the tropical year (365.2422 days). Without leap years, seasons would shift by approximately 24 days per century.
The calculator uses the proleptic Gregorian calendar, applying modern leap year rules retroactively. Historical dates before October 15, 1582 (or later in some countries) originally followed the Julian calendar, which had a simpler leap year rule (every 4 years without exception). For historical accuracy prior to 1582, consult Julian calendar references.
JavaScript's Date object reliably handles years from 1 to 9999. Years outside this range may produce undefined behavior. The year 0 does not exist in the Gregorian calendar; year 1 BC is followed directly by year 1 AD.
The pattern originates from Roman calendar reforms. Julius Caesar established a 12-month system with alternating 31 and 30-day months (except February). Augustus later adjusted August to 31 days, taking a day from February. The resulting sequence lacks mathematical regularity and must be memorized or computed.
Subtract the current day number from the total days in the month. For example, on the 10th of a 31-day month: 31 − 10 = 21 days remaining. This calculator provides the total days; the subtraction is straightforward arithmetic.