Skip to content
Time & Date 6 min read

Date Calculator: Add Days, Weeks & Months, and Find Duration Between Dates

Learn how to calculate dates — add or subtract days/weeks/months, find duration between two dates, handle edge cases like leap years and time zones — all with a simple date calculator.

ToolsVito Team

Why Date Math Is Tricky

Adding 30 days to a date sounds trivial — until the result lands in a month with 28 days, or crosses a leap year, or sits on a DST boundary. Calendar math has more edge cases than most developers expect. A date calculator abstracts this complexity, giving you correct results without writing date logic from scratch.

Adding and Subtracting Dates

The most common operations:

  • Add days: What's the date 45 days from now? Used for payment terms (Net 30), trial expiration, and delivery estimates.
  • Add weeks: What's the date 6 weeks from Tuesday? Used for sprint planning and recurring meeting schedules.
  • Add months: What's the date 3 months from June 23rd? Handles month-length differences — 3 months from November 30 is February 28 (or 29 in a leap year).
  • Subtract: What was the date 90 days ago? Used for data retention policies and lookback windows.

Duration Between Two Dates

Find the exact duration between any two dates in days, weeks, months, and years. This handles the same edge cases in reverse: the duration between January 31 and March 1 isn't the same as between January 1 and March 1 in some calculations. Knowing the exact number of days is critical for contracts, interest calculations, and countdowns.

Edge Cases a Date Calculator Handles

  • Leap years: February 29 exists in 2024 and 2028 but not 2026. A calculator accounts for this automatically.
  • Month boundaries: Adding 1 month to January 31 gives February 28 (or 29) — not February 31, which doesn't exist.
  • Year boundaries: December 31 + 1 day = January 1 of the next year. Obvious but worth stating.
  • DST transitions: In timezone-aware calculations, a day might have 23 or 25 hours. For date-only calculations, DST doesn't apply.
  • Weekends and holidays: Business-day calculations skip non-working days. Different countries have different holiday calendars.

Date Math in JavaScript (For Comparison)

const d = new Date("2026-06-23");
d.setDate(d.getDate() + 45);  // Add 45 days
// Handles month/year rollover automatically

const diff = (date2 - date1) / (1000 * 60 * 60 * 24);
// Milliseconds → days

But setMonth() has known quirks (adding 1 month to Jan 31 gives March 2 or 3 in some implementations). A purpose-built date calculator handles these correctly.

Calculate Dates Instantly

Use ToolsVito's Date Calculator to add or subtract days, weeks, or months from any date, or find the exact duration between two dates. All in your browser.

Try it now — free, runs in your browser

Date Calculator

Add or subtract days, weeks, months