Calculate days between dates or add/subtract durations from a date
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.
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)
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.