Days between two dates

Pick two dates and see the time between them as years, months and days, as a total number of days, weeks and hours, and as business days.

  • Free
  • No sign-up
  • Runs in your browser
date-difference

Fill in the values above to see the result.

100% private — the calculation is done in your browser and nothing is sent to any server.

Guide: What week of the year is it? How ISO week numbers work

How it works

Pick the two dates

In any order: the result is the same.

Decide about the last day

Count it if you need an inclusive range, such as a hotel stay or a leave period.

Read the result

Years, months and days, total days, weeks, hours and business days.

How long is it between two dates?

The question comes up all the time: how many days until an event, how long a contract lasted, how long since something happened, how many days of leave are covered by a period, how far apart two milestones on a project are. Counting on a calendar is slow and full of traps, such as months of different lengths and leap years. This calculator gives the answer in several forms at once.

Years, months and days

The first result is a calendar difference, the way a person would say it: for example "1 year, 2 months, 3 days". It is worked out by counting whole years, then whole months, then the remaining days, taking into account the real length of each month, so it does not depend on averages. Because months are unequal, the number of months and days can differ from what you get by dividing the total days by 30.

Total days, weeks and hours

The total number of days is exact and unaffected by daylight saving changes, because dates are treated as pure calendar days. From it come the weeks, with the remainder in days, and the hours and minutes, which are simply days multiplied by 24 and 1,440. Use them for a quick sense of scale, such as "18,000 hours".

Inclusive or not?

By default the end date is not counted: from the 1st to the 2nd is one day. If you need both the first and last day, as for a hotel booking where the nights count, a period of annual leave or a course that runs from one date to another, tick the inclusive option, and the 1st to the 2nd becomes two days.

Business days

The last result counts the weekdays, Monday to Friday, between the dates. It does not subtract public holidays, which vary by country and region. If you need to exclude specific holidays, use the business days calculator, where you can list them and choose which days are the weekend.

What it does not do

It works with calendar dates, not times of day or time zones. It uses the Gregorian calendar for all dates, including those before its adoption. To add or subtract time from a date instead, use the add days to a date tool.

In Excel and Google Sheets

A date is a whole number in a spreadsheet, so most of this is plain subtraction. With the start date in A2 and the end date in B2 (here 10 February 2024 and 17 October 2026):

Spreadsheet formulas for this calculation
To getFormulaResult
Days between the dates=B2-A2980
The same, as a function (end date first)=DAYS(B2,A2)980
Counting both the first and the last day=B2-A2+1981
Complete years=DATEDIF(A2,B2,"Y")2
Months left over after the years=DATEDIF(A2,B2,"YM")8
Days left over after the months=B2-EDATE(A2,DATEDIF(A2,B2,"M"))7
Complete weeks=INT((B2-A2)/7)140

The formulas use English function names and commas. If your Excel or Google Sheets is set to another language, the function names change, and in many countries the separator between arguments is a semicolon.

  • The calculator does not count the end date unless you tick the inclusive option; =B2-A2 behaves the same way, and +1 matches the inclusive option.
  • If the result shows up as a date, change the cell format to General or Number.
  • DATEDIF is documented by Microsoft and by Google Sheets. Avoid its "MD" unit: Microsoft says it "may result in a negative number, a zero, or an inaccurate result", which is why the days left over are worked out from EDATE above.

Frequently asked questions

How do I calculate the number of days between two dates?

Pick the two dates. The total number of days appears at once, together with the same period in years, months and days.

Is the last day counted?

Not by default. Tick "Count the end date as well" to include it, which adds one day.

Why don't months and days match the total days divided by 30?

Because months have different lengths. The calculator counts real calendar months, not an average.

Does it handle leap years?

Yes. Dates are treated as real calendar days, so February 29 is counted in leap years.

Can I count only working days?

The result includes a count of Monday-to-Friday days. To exclude holidays, use the business days calculator.

Are my dates sent anywhere?

No. The calculation is done in your browser.

How do I calculate the days between two dates in Excel?

Put the earlier date in A2 and the later one in B2, and use =B2-A2. Add 1 if both the first and the last day count. For whole months or years use =DATEDIF(A2,B2,"M") or "Y". It works the same in Google Sheets.