Menu
Advertisement

Days Between Dates Calculator

Pick two dates to see how many days lie between them, and the same gap in weeks, months and hours. One tick counts the end date too.

By Nethanel Bar, Co-founder & CEO

Last updated

Advertisement

Ready to actually learn to code?

Coddy teaches you by writing real code in your browser - interactive lessons, instant feedback, and AI help when you get stuck.

How to count the days between two dates

Counting days sounds easy until you ask whether both ends count. From Monday to Friday is 4 days by subtraction, which is how a calendar or a program counts a gap. If you mean every day of a trip, Monday through Friday, it is 5. The tool counts the first way and adds the end day when you tick Count the end date too (adds 1 day). A deadline, a notice period or the nights of a stay usually want the first answer; a festival or a course that runs every day wants the second.

Under the number of days you get the same gap four more ways. Weeks and days is the days divided by 7. Years, months and days counts the most whole months that fit, then the days left, so a month is not treated as 30 days. Hours are the days times 24. Weekdays (Monday to Friday) and weekend days split the span, which is a quick check before you plan work around it. If the end date is earlier than the start, the tool swaps the two and says so.

The start date begins on today, taken from your device's own clock and time zone, and both dates have a Today button. You can enter any date from 1900 to 2100, and everything is worked out in your browser. To count working days only, with your own days off and public holidays, open the Working days page.

What counting days teaches you

  • A day count is a subtraction. Turn each date into a day number and take one from the other, which is why the end day is left out unless you add it back.
  • Months have no fixed length. Three months can be 89 to 92 days, so a gap in months and days depends on where it starts: January 31 to March 1 is 1 month and 1 day.
  • Leap years follow a three-part rule: every year divisible by 4, except century years, unless they divide by 400. 2000 had a February 29; 1900 and 2100 do not.
  • Weekdays repeat every 7 days, so each whole week in a span holds exactly 5 of them. Only the days left over need checking one by one.
  • In code, subtracting two dates gives a duration. In Python, date(2026, 6, 30) minus date(2026, 3, 1) is a timedelta, and its .days is 121.

How to use the day counter

  1. Set the start date

    It starts on today. Pick a day, a month and a year to change it, or press Today to come back.

  2. Set the end date

    Enter the day you are counting to, or press Today. If it comes before the start date, the two are swapped and a note tells you.

  3. Decide about the last day

    Tick Count the end date too (adds 1 day) when the first and the last day should both count, as on a trip or a course that runs every day.

  4. Read the result

    The big number is the days. Below it are the weeks and days, the years, months and days, the hours, and the weekdays and weekend days in the span.

How many days common spans hold

Weeks never change length. Months and years do, so the count depends on which dates you pick.

SpanDaysWhy it varies
1 week7It does not
1 month28 to 31February has 28 days, or 29 in a leap year
2 months59 to 62Depends on which two months it covers
3 months89 to 92Shorter when February is inside the span
6 months181 to 184Depends on the months and on February 29
1 year365 or 366366 when a February 29 falls inside the span
Monday to Friday4, or 5 with the end dateThe end day is left out unless you tick the box

Counting days in practice

A project from March to June

Paste a small example into the tool and change one part at a time.

121 days, which is 17 weeks and 2 days, or 3 months and 29 days, or 2,904 hours. 86 of the days are weekdays and 35 are weekend days. June 30 itself is not counted; tick the box and the answer becomes 122 days, exactly 4 months.

A trip where every day counts

Copy the original value, run the tool, then compare the result.

15 days, or 2 weeks and 1 day, because both Saturdays count. 10 of them are weekdays and 5 are weekend days. Without the tick the answer is 14, which is the number of nights.

Across the end of a month

Take a value from your own work and use this tool to inspect or prepare it.

29 days, shown as 1 month and 1 day. One month after January 31 lands on February 28, because February has no 31st, and March 1 is one day later. In 2028, a leap year, the same dates are 30 days apart and still 1 month and 1 day.

The same count in Python

datetime and dateutil
from datetime import datefrom dateutil.relativedelta import relativedelta
start, end = date(2026, 3, 1), date(2026, 6, 30)print((end - start).days)         # 121print((end - start).days + 1)     # 122, end date countedprint(relativedelta(end, start))  # relativedelta(months=+3, days=+29)

Subtracting two dates gives a timedelta, and .days is the plain count the tool shows. relativedelta, from the python-dateutil package, counts months the same way as the years, months and days line.

Common day-counting mistakes

  • Not deciding whether the end day counts. A stay from the 10th to the 24th is 14 nights but 15 days, so choose before you read the answer.
  • Treating a month as 30 days. 90 days and 3 months are different spans, and the gap grows the longer the period.
  • Dividing the days by 365 to get years. Leap days pile up, so read the years, months and days line instead.
  • Mixing up the day and the month. 03/04 is March 4 in the US and April 3 in much of the world; the tool names the month to avoid that.
  • Taking weekdays for working days. The weekday count ignores public holidays; the Working days page lets you take them off.

Days between dates FAQ

How many days are there between two dates?

Enter both dates and the number appears at once. The tool subtracts the start date from the end date, so the start day is counted and the end day is not.

Does the day count include both the start and the end date?

Only the start date, by default. Tick Count the end date too (adds 1 day) to count both.

How do I count the days from a past date to today?

Enter the past date as the start date and press Today under the end date. If you put them the other way round, the tool swaps them for you.

How are months counted in the years, months and days line?

As many whole months as fit, then the days left. A month added to the 31st lands on the last day of a shorter month, so January 31 to March 1 is 1 month and 1 day.

Does it handle leap years?

Yes. February 29 is counted in every leap year, and the century rule is applied: 2000 is a leap year, 1900 and 2100 are not.

How many weekdays are between two dates?

The result lists the weekdays (Monday to Friday) and the weekend days in the span. For your own days off and public holidays, use the Working days page.

Do the hours follow daylight saving time?

No. The hours line is the number of days times 24. To measure between two clock times, use the time duration calculator.

Which dates can I enter?

Any real date from the year 1900 to 2100. A date that does not exist, such as February 30, shows an error.

Learn more

Other developer tools

Coddy programming languages illustration

Learn to code with Coddy

Get started