How to Calculate the Days Between Two Dates
Counting the days between two dates sounds simple until a few months and a leap year get in the way. There is a tidy method that handles it. Here is how to do it by hand, with a worked example and the details that most often cause errors.
The short version: count the days from the start to the end of its month, add the full months in between, then add the days into the final month. Work in calendar days, and remember February changes length in a leap year.
The month-by-month method
Trying to subtract two dates in one step invites mistakes, since months do not share a length. Breaking the span into three parts keeps it clean.
- Count from the start date to the last day of that month.
- Add the day length of every whole month between the two dates.
- Add the day number of the end date.
It helps to know the month lengths: 31 days for January, March, May, July, August, October, and December; 30 for April, June, September, and November; and 28 for February, or 29 in a leap year.
A worked example, step by step
Count the days from March 3 to July 18 in the same year. Work the three parts in order.
- March 3 to March 31: 31 − 3 = 28 days.
- Whole months between: April (30) + May (31) + June (30) = 91 days.
- Into July: 18 days.
Add them up: 28 + 91 + 18 = 137 days. So March 3 and July 18 are 137 days apart. You can check the idea on a calendar app, but the method scales to any pair of dates without one.
Leap years and February
A span that crosses February 29 picks up an extra day. A year is a leap year if it divides evenly by 4, except for full centuries, which must divide by 400. So 2024 is a leap year, 2000 was, but 1900 was not.
If your two dates straddle a leap day, count February as 29 days in that stretch. Miss it and your total comes out one short. This is the single most common slip in longer date spans.
Calendar days, not business days
The method counts calendar days, so weekends and holidays are treated like any other day. That is the right default for birthdays, anniversaries, due dates, and any plain countdown where every day counts equally.
If you need working days for a deadline or a contract, count the calendar days first, then subtract the weekends and any holidays yourself. Those vary by country and company, so there is no single rule that fits everyone.
Turning days into weeks and months
Once you have the day count, other units follow. For weeks, divide by seven and keep the remainder. Our 137-day span is 137 / 7 = 19 weeks and 4 days, which is useful when you plan something a set number of weeks out.
Months are trickier, since they vary in length. The clean way is to read the calendar directly: from March 3 to July 3 is four whole months, and July 3 to July 18 adds 15 days. So the same span is about 4 months and 15 days. The day count never changes, only how you describe it.
Common mistakes to avoid
- Using 30 days for every month. Real months run 28 to 31 days, so use the true lengths.
- Forgetting February 29 on a span that crosses a leap day, which leaves you one day short.
- Mixing calendar days with working days. Decide which you need before you start.
- Double-counting an endpoint. The same date for start and end is zero days apart, not one.
Frequently asked questions
Does the order of the dates matter? Not for a plain span. The distance from an earlier date to a later one is the same either way, so the count is zero or greater.
Should I count both the first and last day? For a plain gap, no. Consecutive days are one day apart, and the same date for both ends is zero. Some event counts include both ends, so check what you need.
How are leap years handled? A span that crosses February 29 includes that extra day. Use 29 days for February in a leap year, and 28 otherwise.
How do I count business days? Count calendar days first, then subtract weekends and holidays. Those depend on your country and company, so they need a separate step.
Do I need to do this by hand? No. The method is handy to know, but a tool is faster and avoids leap-year slips. Use the one below to get the gap in days, weeks, and months in a second.