Loading tool…
How to Calculate the Number of Days Between Two Dates
Counting the days between two dates involves converting each date to a common numeric form (like a Julian day number or Unix timestamp) and subtracting.
- Convert each date to its day-of-year value: count the days from January 1 of that year, adding month lengths (31, 28/29, 31, 30 …).
- If both dates fall in the same year, simply subtract the two day-of-year values.
- If the dates span different years, count the remaining days in the start year, add 365 (or 366) for each full year in between, then add the day-of-year of the end date.
- For working days, iterate through each day and skip Saturdays and Sundays.
- For a years-months-days breakdown, subtract each component individually and borrow from the next-larger unit when the result goes negative — the same carry technique used in age calculation.
Date Difference Formula
Total days = ⌊(Date₂ − Date₁) ÷ 86 400 000⌋ when both dates are expressed as Unix timestamps in milliseconds. Working days are found by iterating calendar days and excluding those where day-of-week is 0 (Sunday) or 6 (Saturday). The years/months/days breakdown uses successive subtraction with borrowing — no single closed-form formula exists because month lengths vary.
Why Use Our Date Difference Calculator?
- Instant multiple formats — total days, weeks, working days, weekends, and the full year-month-day breakdown in one view.
- No sign-up required — paste your dates, get results. Nothing stored, nothing tracked.
- Built-in presets — quick buttons for 'Days until Christmas', 'Days since Y2K', and more.
- Working-day aware — excludes Saturdays and Sundays automatically for business planning.
- Shareable result — the URL includes your chosen dates so you can bookmark or send the calculation.
Frequently Asked Questions
How do I count working days between two dates?
Iterate through every calendar day from the start date to the end date and exclude Saturdays (day 6) and Sundays (day 0). Our calculator does this automatically and shows the working-day count alongside total days.
Does the calculator handle leap years?
Yes. February has 29 days in leap years (years divisible by 4, except centuries not divisible by 400). All date math uses the real calendar, so leap days are included in every calculation.
How many days are in a year?
A common year has 365 days. A leap year has 366. On average (the Gregorian cycle), a year is 365.2425 days. The calculator uses the actual calendar rather than averages, so every day is counted precisely.
Can I include or exclude public holidays?
Currently the working-day count excludes only weekends (Saturday and Sunday). Public holidays vary by country and region, so they are not subtracted automatically. You can manually adjust the result by subtracting the number of holidays that fall on weekdays.
What's the difference between 'days' and 'working days'?
Total days counts every calendar day including weekends. Working days (also called business days) count only Monday through Friday. The weekend-day count is the difference between the two.
Is my data private?
Completely. The calculation runs in your browser's JavaScript engine. No dates are sent to any server, logged, or stored in cookies.