Date Difference Calculator
Dates and calendar duration
Choose two dates
Result
Calculation summary
Enter values to see the result
Calendar timeline
Date interval at a glance
How to use this calculator
- 1Choose the two calendar dates you want to compare.
- 2Turn on inclusive counting when both the first and last date should count.
- 3Calculate to see the calendar duration and equivalent total days, weeks, and hours.
Formula
Total days = later calendar date − earlier calendar date + optional inclusive day
The calculator compares date-only values on a UTC calendar scale, then decomposes the interval into whole calendar years, months, and remaining days.
Calculation steps
- Validate both inputs as unambiguous YYYY-MM-DD calendar dates.
- Order the dates chronologically while preserving a warning when they were entered in reverse.
- Count calendar-day boundaries, adding one day when inclusive counting is enabled.
- Find whole years and months using clamped calendar anniversaries, then count the remaining days.
- Convert total calendar days to whole weeks, remaining days, and 24-hour day equivalents.
Worked example
From January 1, 2026 to January 1, 2027, the exclusive difference is 1 calendar year, 365 total days, 52 whole weeks plus 1 day, or 8,760 hours.
Assumptions
- Inputs are Gregorian calendar dates without a time of day or time zone.
- Total hours are calendar-day equivalents at 24 hours per day, not elapsed clock hours across daylight-saving changes.
- When a monthly or yearly anniversary does not exist, it is clamped to the last valid day of that month.
- Inclusive counting adds the later date to the counted interval; the default excludes it.
- If dates are entered in reverse, the calculator reports the same absolute interval and displays a warning.
Sources
Frequently asked questions
Does the result include the end date?
Not by default. Enable inclusive counting to count both boundary dates, which adds one calendar day to the interval.
Why can a calendar month have different numbers of days?
Calendar months have 28, 29, 30, or 31 days. The exact years-months-days result follows calendar anniversaries rather than treating every month as a fixed number of days.
How are leap years handled?
Gregorian leap-year rules are applied. February has 29 days in years divisible by 4, except century years not divisible by 400.
What happens if the start date is later?
The calculator uses the absolute chronological interval and displays a warning that the entered dates were reversed.
Are the total hours affected by daylight saving time?
No. This is a date-only calculator, so hours are shown as total calendar days multiplied by 24. It does not measure clock time in a location or time zone.