Date Duration Calculator
This professional date duration calculator computes the exact difference between two dates (and optional times). It is designed for planners, HR teams, project managers, legal professionals, researchers, and anyone who needs a precise, explainable breakdown across calendar years, months, days, weeks, total days, and business days, with options to exclude weekends and custom holidays.
Interactive Calculator
When 'Include time' is ON, totals use exact timestamps. Daylight Saving transitions are respected.
Results
Enter valid dates to see the duration summary.
Timezone: using your device's local time.
Data Source and Methodology
Authoritative standard: ISO 8601 — Date and time — Representations for information interchange.
- ISO 8601-1:2019 (Basic rules). ISO, 2019. iso.org/standard/70907.html
- ISO 8601-2:2019 (Extensions). ISO, 2019. iso.org/standard/70908.html
Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.
The Formula Explained
Leap-year rule (Gregorian):
$$\text{Leap}(y) \iff \big(y \bmod 4 = 0\big) \land \big(y \bmod 100 \ne 0\big) \;\; \lor \;\; \big(y \bmod 400 = 0\big).$$
Total seconds and days between timestamps t₁ and t₂:
$$\Delta t = |t_2 - t_1|,\quad \text{TotalDays} = \left\lfloor \frac{\Delta t}{86\,400\ \text{s}} \right\rfloor.$$
Inclusive end date (date-only mode):
$$\text{TotalDays}^{(\text{inclusive})} = \text{TotalDays} + 1.$$
Weeks and remaining days:
$$\text{Weeks} = \left\lfloor \frac{\text{TotalDays}}{7} \right\rfloor,\quad \text{DaysRem} = \text{TotalDays} - 7\cdot\text{Weeks}.$$
Business days (excluding weekends and a holiday set H):
$$\text{BusinessDays} = \sum_{d \in [D_1,D_2]} \mathbf{1}\big(\text{weekday}(d) \notin \{\text{Sat},\text{Sun}\} \land d \notin H\big).$$
Glossary of Variables
- Start date/time: Beginning of the interval.
- End date/time: End of the interval.
- Include time: Use hours and minutes for higher precision.
- Include the end date: Count both start and end dates in date-only totals.
- Exclude weekends: Remove Saturdays and Sundays from business day totals.
- Custom holidays: Specific dates that are subtracted from business day totals.
- Calendar span (Y M D): Human-friendly decomposition into years, months, and days.
- Total days / weeks + days: Absolute totals across the range.
- Total hours / minutes / seconds: Exact totals from timestamps (if time is included).
- Business days: Weekdays within the interval after excluding weekends and listed holidays.
How It Works: A Step-by-Step Example
Scenario: Start = 2020-01-15, End = 2024-03-20, Include time = OFF, Include end date = ON, Exclude weekends = OFF.
- Compute calendar span by advancing whole years and months from the start until not exceeding the end: 4 years, 2 months, 5 days.
- Inclusive total days: from 2020-01-15 to 2024-03-20 inclusive = 1,526 days.
- Weeks + days: 1,526 = 218 weeks and 2 days.
- Since weekends are not excluded and no holidays are set, business days are equal to the weekday count within the range.
Frequently Asked Questions (FAQ)
What calendar system is used?
The proleptic Gregorian calendar aligned with ISO 8601. Leap years follow the 4/100/400 rule.
Do results change with time zones or DST?
When time is enabled, results use your device's local timezone. Daylight Saving shifts are reflected in hour totals. Date-only computations use local dates at 00:00.
How should I enter holidays?
Use ISO format YYYY-MM-DD, one per line or comma-separated. They are excluded from business day totals if they fall on a weekday within your range.
Is the end date counted?
Only if 'Include the end date' is checked and time-of-day is OFF. With time enabled, precise timestamps make the inclusive option unnecessary.
How accurate is the calendar span (Y M D)?
It is computed by incrementally adding whole years and months from the start without overshooting the end, then counting remaining days—robust across variable month lengths and leap years.
What if I paste an invalid date?
Inline validation flags the field with a helpful message. Fix the format or use the date picker to continue.
Can I compute business days only?
Yes. Turn on 'Exclude weekends' and optionally add holidays. We will display business days alongside total days.