What the Date Difference Calculator does
The Date Difference Calculator measures the span between two calendar dates. It reports total days, the number of full seven-day weeks within that total and the days left over, plus a breakdown in years, months and days that follows real month lengths.
By default the count is exclusive: it counts the midnights crossed between the two dates, so Monday to Friday is 4 days. Tick 'Include both start and end dates' and the total becomes 5, which is the convention for counting days of leave, course days, rental days and other ranges where the last date is used in full.
Both fields open on today's date, so the result starts at zero. Enter the end date before the start date and the tool still works: it shows the positive difference and marks the breakdown as '(dates reversed)'. The whole calculation runs in your browser; the dates never leave your device.
How to use it
Set the start date
Choose the first date of the period with the date picker or type it. The field opens on today's date.
Set the end date
Choose the second date. It can be before or after the start date; the tool always reports the positive difference and notes when the dates are reversed.
Decide whether both ends count
Leave the box unticked to count elapsed days, or tick it to add one day so that both the first and the last date are included.
Exclusive and inclusive counting, and when each is right
Counting from 1 January to 31 January gives 30 days exclusive and 31 days inclusive. The exclusive figure answers 'how many days have passed' and suits ages, elapsed time and interest periods. The inclusive figure answers 'how many dates are in this range' and suits counting the days of a holiday, a course or a rental where the last day is used in full.
A stay from 1 March to 15 June covers 106 nights (exclusive) or 107 calendar dates (inclusive). The weeks line follows whichever total you choose: 106 days is 15 full weeks and 1 extra day, while 107 days is 15 weeks and 2 days.
The years, months and days breakdown always uses the exclusive difference. That line describes the calendar distance between the two dates, so ticking the inclusive box changes the total days and the weeks figures but not the breakdown.
Why the tool works at UTC midnight
Dates typed into the two fields are turned into UTC midnight timestamps with the browser's Date.UTC function, and the difference is divided by the number of milliseconds in a day. Because UTC has no daylight saving, every day is exactly 24 hours and the division always lands on a whole number.
Calculators that use local time can be a day out around a daylight saving change, because one day in spring is only 23 hours long and one in autumn is 25. Working in UTC avoids that class of error. The MDN documentation for the Date object describes both approaches.
The breakdown into years, months and days is produced by stepping forward whole years, then whole months, then days, using the real length of each month. When a step lands on a day that does not exist, such as the 31st of a short month, it uses the last day of that month instead.
What the result does not include
Every calendar day is counted. The tool does not skip weekends or public holidays, so it is not a business-days calculator. For a working-day count, subtract the weekends and holidays in your region yourself, or count only the full weeks and multiply by five as a first approximation.
Times of day are ignored. An event at 23:00 on one date and 01:00 on the next is still one day apart. If you need hours and minutes within a single day, the Time Duration Calculator on this site handles clock times.
Limits to know before you rely on it
- All calendar days are counted; weekends and public holidays are not excluded.
- Times of day are ignored, so the result is always a whole number of days.
- The years, months and days breakdown always uses the exclusive count, even with the inclusive box ticked.
- Only the Gregorian calendar is supported; convert dates from other calendars before entering them.
- Month-end dates are clamped to the last day of a shorter month, which can differ from other tools by a day.
Questions people ask about the Date Difference Calculator
How many days are there between two dates?
Enter both dates and read the Total days figure. With the box unticked, the tool counts the days that elapse from the first midnight to the second, so 14 October 2026 to 1 January 2027 is 79 days, which is 11 full weeks and 2 extra days.
Should I include the start and end date?
Include both when every date in the range matters, such as days of leave, a course that runs on its last day, or the number of daily doses in a prescription. Leave them out when you are measuring how much time has passed, such as how long since an invoice was issued or an interval that starts the day after an event.
What happens if the end date is before the start date?
The tool swaps them internally, shows the positive number of days and weeks, and adds '(dates reversed)' after the breakdown. You do not need to re-enter anything, which makes it easy to count back to a past date.
Does daylight saving time change the day count?
No. The dates are converted to UTC midnight before subtracting, so every day is exactly 24 hours in the arithmetic. Local clock changes in spring and autumn cannot push the result off by one.
Can I count working days or business days with this tool?
Not directly. The count includes Saturdays, Sundays and holidays. Multiply the full weeks by five and add the weekdays among the extra days for a rough working-day figure, then remove any public holidays that fall in the range.
How is the weeks figure worked out?
Total days are divided by seven. The whole-number part is shown as full weeks and the remainder as extra days. For 30 days the tool shows 4 weeks and 2 days; for 31 days it shows 4 weeks and 3 days.
Sources and further reading
- MDN Web Docs: the JavaScript Date object, including the date-only string format and the UTC handling the tool relies on
- MDN Web Docs: Date.UTC(), which builds the midnight timestamps so that each day is exactly 24 hours
- Wikipedia: ISO 8601, the YYYY-MM-DD date format used by the browser's date inputs
- Wikipedia: Gregorian calendar, the month lengths and leap-year rules behind the years, months and days breakdown