Date Calculator

Calculate days between dates or add/subtract durations from a date

What is Date Calculator?

Date Calculator is a free, browser-based tool for computing the difference between two dates and for adding or subtracting time units from any date. Unlike generic spreadsheet formulas, this calculator handles edge cases like leap years, varying month lengths, and business-day exclusions automatically.

Developers frequently need precise date math when writing code that involves deadlines, expiration windows, scheduled jobs, or audit trails. A billing system might need to calculate the exact number of days in a pro-rated subscription period. A deployment pipeline might enforce a 30-day retention window. A compliance workflow might require knowing the exact number of business days between two events.

This tool provides two modes: Difference mode computes the span between a start and end date, expressed in days (calendar or business), weeks, months, and years. Add/Subtract mode computes a future or past date by adding or removing years, months, weeks, and days from a base date β€” useful for calculating deadlines, notice periods, or grace windows.

All calculations run entirely in your browser using JavaScript's built-in Date API, so no data is sent to a server and the tool works offline after the first load.

How to Use

  1. Select the Difference tab to measure the gap between two dates, or the Add/Subtract tab to find a future or past date.
  2. Enter your dates using the date picker or by typing in YYYY-MM-DD format.
  3. For Difference mode, optionally check Exclude weekends to count only Monday–Friday business days.
  4. For Add/Subtract mode, enter the number of years, months, weeks, or days to add (positive) or subtract (negative).
  5. The result updates instantly β€” copy it or read the ISO date, Unix timestamp, and ISO week number shown below.

Examples

Invoice due date: Start: 2024-03-01, Add: 30 days

β†’ Result: 2024-03-31 (Sunday) β€” due on the last day of March

SLA window: Start: 2024-06-10, End: 2024-06-24, business days only

β†’ Result: 10 business days (excludes June 15–16 weekend and June 22–23 weekend)

Subscription expiry: Start: 2024-01-31, Add: 1 month

β†’ Result: 2024-02-29 (clamped to last day of February in a leap year)

Frequently Asked Questions

Does this handle leap years correctly?

Yes. Adding one month to January 31 yields February 28 (or 29 in a leap year), not March 2. The calculator clamps to the last valid day of the target month.

What counts as a business day?

Business days are Monday through Friday. Public holidays are not excluded because they vary by country and region β€” you would need to adjust manually for those.

Can I calculate dates before 1970?

Yes. The calculator works with dates from roughly year 100 to 9999, not just Unix epoch range.

Is this accurate for time zones?

The calculator works with calendar dates only, not times. If you need timezone-aware datetime math, use a library like date-fns or Luxon in your code.

How do I copy the result?

Click anywhere on the result value to select it, then Ctrl+C / Cmd+C. The ISO date and Unix timestamp are shown separately so you can copy whichever format you need.

Related Tools