Other · Live
Date math, done
three ways.
Find the difference between any two dates, add or subtract a duration, or count business days, all in one tool. UTC arithmetic so leap years, month-end edge cases, and year-rollover never bite you.
Inputs
Pick a mode
Days, weeks, months between two dates
- Total days
- —
- Total weeks
- —
Time between
Years · months · days
Pick two valid dates above to see the difference.
Field guide
Why date math is harder than it looks.
Date arithmetic looks simple — you subtract one date from another and you're done. In practice the calendar is a patchwork of compromises that has tripped up programmers for decades: months with different lengths, leap years, century rules, time zones, daylight saving transitions. This calculator avoids the worst traps by working in UTC and using calendar-aware arithmetic for years and months.
Mode 1: Difference between two dates
The most common question: “how many days from X to Y?” Subtracting milliseconds and dividing by 86,400,000 gives the day count. Translating that into years and months uses the standard calendar diff , exactly how you'd do it on paper.
totalWeeks = ⌊totalDays ⁄ 7⌋
Mode 2: Add or subtract a duration
For days and weeks, the math is millisecond addition. For months and years, you have to handle the calendar itself:
- January 31 + 1 month → February 28 (or 29 in a leap year). The day clamps to the last valid day of the target month.
- February 29 + 1 year → February 28 in non-leap years. Same clamping rule.
- December 15 − 24 months → December 15 of two years prior. Years just shift.
The clamping rule is the same one most spreadsheets and databases use (Google Sheets EDATE, SQL DATE_ADD). It avoids the “Feb 31 became March 3” bug that naive implementations produce.
Mode 3: Business days
Counting business days means counting the Mondays through Fridays inclusive of both endpoints. The calculator walks the span day-by-day for short ranges and uses a closed-form formula (full weeks × 5 + remainder) for very long ones.
Holidays are not deducted automatically — they vary by country, region, and year. Take the workday count above and subtract the holidays that fall on weekdays in your jurisdiction. For example, US federal holidays in a typical year shave about 10 workdays off any full-year count.
Leap years
A year is a leap year if it's divisible by 4, except century years, which must also be divisible by 400. So 2000 was a leap year, 1900 wasn't, and 2100 won't be. Across a span of decades, leap years account for the gap between “365 × N” and the actual day count.
Worked example: contract renewal
A contract starts 2026-03-15 and runs for 18 months. When does it expire?
- March + 18 months = September of the following year
- Day 15 fits in September (which has 30 days)
- Result: September 15, 2027
Worked example: project days
A sprint runs 2026-04-06 (Monday) to 2026-05-29 (Friday). How many working days?
- Total calendar days (inclusive):
54 - Full weeks:
54 ÷ 7 ≈ 7.7 - Workdays: roughly
40(8 Mon–Fri windows)
A note on time zones
This calculator treats both dates as plain calendar dates, without time-of-day or timezone semantics. That's the right behaviour for “how many days between June 1 and July 4” — what matters is the calendar difference, not what hour the day starts in your time zone.
Common uses
- Contracts and leases: renewal dates, notice periods.
- Project management: sprint length, deadline countdown.
- Travel planning: trip duration, days until departure.
- Pregnancy / due dates: weeks since LMP.
- Subscriptions: when does the next billing fall on a weekend?