Date Calculator

How to Add or Subtract Days from a Date

📅 April 2026⏱ 6 min read✍️ ToolsBox

Date arithmetic is a surprisingly common need — calculating a project deadline 90 days from today, finding what date falls 14 days before an event, working out payment terms 30 days after invoice date, or debugging code that generates incorrect due dates. This guide covers manual calculation, spreadsheet formulas, JavaScript code, and the fastest approach: using a free online date calculator.

Why Date Arithmetic Is Trickier Than It Looks

Adding 7 days to a date is straightforward. But date arithmetic becomes tricky because:

  • Months have different numbers of days (28, 29, 30, or 31)
  • Leap years add an extra day to February every 4 years (approximately)
  • Year boundaries (adding 100 days to December 20 crosses into the next year)
  • The difference between calendar months and day counts — "one month from January 31" is ambiguous

Simple addition works fine for days and weeks. For months and years, the calculation requires more care.

Adding Days to a Date

For days, the approach is to convert to a day number (days since a fixed epoch like January 1, 1970 in Unix time), add your days, and convert back to a calendar date. This automatically handles month and year boundaries.

Example: What date is 90 days from April 17, 2026?

April has 30 days. Days remaining in April: 30 − 17 = 13. After April: 90 − 13 = 77 days into the future. May: 31 days (77 − 31 = 46 remaining). June: 30 days (46 − 30 = 16 remaining). 16 days into July = July 16, 2026.

Our Date Calculator does this instantly — enter any date and number of days, and the result appears immediately without manual counting.

Date Arithmetic in Spreadsheets

Spreadsheets (Excel, Google Sheets, LibreOffice Calc) make date arithmetic simple because they store dates as numbers (days since a baseline date) internally:

  • Add days: =A1 + 30 — adds 30 days to the date in A1
  • Add months: =EDATE(A1, 3) — adds exactly 3 months (using the same day number)
  • Add years: =DATE(YEAR(A1)+1, MONTH(A1), DAY(A1))
  • Days between dates: =B1-A1 — the result is the number of days (format the cell as a number, not a date)
  • Workdays only: =WORKDAY(A1, 30) — adds 30 working days (excludes weekends)
  • Business days between: =NETWORKDAYS(A1, B1) — counts only working days

Date Arithmetic in JavaScript

// Add days to a date
function addDays(date, days) {
  const result = new Date(date);
  result.setDate(result.getDate() + days);
  return result;
}

// Subtract days
function subtractDays(date, days) {
  return addDays(date, -days);
}

// Add months (clamping to last day if needed)
function addMonths(date, months) {
  const result = new Date(date);
  result.setMonth(result.getMonth() + months);
  return result;
}

// Days between two dates
function daysBetween(date1, date2) {
  const msPerDay = 1000 * 60 * 60 * 24;
  return Math.ceil((date2 - date1) / msPerDay);
}

Note that JavaScript's setDate() automatically handles month overflow — setting the date to day 32 of January automatically advances to February 1. This is usually what you want.

Common Date Calculation Use Cases

  • Payment terms: "Net 30" means payment is due 30 days after the invoice date. Add 30 days to the invoice date.
  • Project deadlines: A 12-week project deadline is 84 days (12 × 7) from the start date.
  • Subscription renewals: A monthly subscription renews on the same day next month (use addMonths, not add 30 days).
  • Warranty expiry: A 2-year warranty expires 2 years after the purchase date. Use addMonths(date, 24) or add years.
  • Legal deadlines: Many legal processes have 30-day or 90-day windows from specific trigger dates.

For all of these, our Date Calculator handles the calculation accurately without you having to count days manually or write code.

Calculate dates instantly — free

Add or subtract days, weeks, months from any date. Find the difference between two dates.
Open Date Calculator →

Frequently Asked Questions

How do I add 30 days to today's date?

Use our Date Calculator — enter today's date, select 'Add', enter 30 days, and the result appears instantly. In JavaScript: new Date(new Date().setDate(new Date().getDate() + 30)). In Excel: =TODAY()+30.

What date is 90 days from today?

Use our Date Calculator for the exact date. As a rough guide, 90 days is approximately 3 months. The exact date depends on which months are involved — some months have 28, 29, 30, or 31 days, so 90 days does not always equal 3 calendar months.

How do I calculate the number of days between two dates?

Subtract the earlier date from the later date. In JavaScript: Math.ceil((date2 - date1) / (1000 * 60 * 60 * 24)). In Excel: =DATEDIF(startDate, endDate, "D") or simply =endDate - startDate formatted as a number. Our Date Calculator handles this automatically.

Does adding months always give the same day of the month?

Not always. Adding 1 month to January 31 gives February 28 or 29 (not February 31, which doesn't exist). Different date libraries handle this differently — some 'clamp' to the last day of the month, others 'overflow' to March 2 or 3. Clamping is the more intuitive behaviour.

Back to Blog  |  Related tool: Date Calculator