Date Duration Calculator

Professional date duration calculator: compute precise time between two dates (and times), including years, months, days, weeks, total days, business days, and exclusions for weekends and custom holidays. WCAG 2.1 AA accessible and mobile-first.

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

Options

Listed days are removed from business day totals.

Configure time inclusion, inclusive end date, weekend exclusions, and optional holidays.

Results

Enter valid dates to see the duration summary.

Calendar span (Y M D)
Weeks + days
Total days
Business days
Total hours
Minutes / Seconds

Timezone: using your device's local time.

Data Source and Methodology

Authoritative standard: ISO 8601 — Date and time — Representations for information interchange.

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.

  1. Compute calendar span by advancing whole years and months from the start until not exceeding the end: 4 years, 2 months, 5 days.
  2. Inclusive total days: from 2020-01-15 to 2024-03-20 inclusive = 1,526 days.
  3. Weeks + days: 1,526 = 218 weeks and 2 days.
  4. 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.


Audit: Complete
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Formula (extracted LaTeX)
\[\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).\]
\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).
Formula (extracted LaTeX)
\[\Delta t = |t_2 - t_1|,\quad \text{TotalDays} = \left\lfloor \frac{\Delta t}{86\,400\ \text{s}} \right\rfloor.\]
\Delta t = |t_2 - t_1|,\quad \text{TotalDays} = \left\lfloor \frac{\Delta t}{86\,400\ \text{s}} \right\rfloor.
Formula (extracted LaTeX)
\[\text{TotalDays}^{(\text{inclusive})} = \text{TotalDays} + 1.\]
\text{TotalDays}^{(\text{inclusive})} = \text{TotalDays} + 1.
Formula (extracted LaTeX)
\[\text{Weeks} = \left\lfloor \frac{\text{TotalDays}}{7} \right\rfloor,\quad \text{DaysRem} = \text{TotalDays} - 7\cdot\text{Weeks}.\]
\text{Weeks} = \left\lfloor \frac{\text{TotalDays}}{7} \right\rfloor,\quad \text{DaysRem} = \text{TotalDays} - 7\cdot\text{Weeks}.
Formula (extracted LaTeX)
\[\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).\]
\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).
Formula (extracted text)
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).$
Variables and units
  • No variables provided in audit spec.
Sources (authoritative):
Changelog
Version: 0.1.0-draft
Last code update: 2026-01-19
0.1.0-draft · 2026-01-19
  • Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Verified by Ugo Candido on 2026-01-19
Profile · LinkedIn

Full original guide (expanded)

Formulas

(Formulas preserved from original page content, if present.)

Version 0.1.0-draft
Citations

Add authoritative sources relevant to this calculator (standards bodies, manuals, official docs).

Changelog
  • 0.1.0-draft — 2026-01-19: Initial draft (review required).