Skip to content

Add or Subtract Time from a Date

Pick a start date, choose a duration, and instantly see the resulting date. Handles month-end clamping correctly — no surprises.

Days vs months — why it matters

Adding a fixed number of days is unambiguous — 30 days from any date is always 30 × 86,400 seconds later. Adding months is calendar-aware: one month from January 15 lands on February 15, but one month from January 31 must clamp to February 28 because February doesn't have 31 days. Working with a raw Unix timestamp instead of a calendar date? Use Add / Subtract Time from a Timestamp for pure fixed-duration arithmetic instead.

JavaScript's built-in setMonth does not clamp — it rolls over into the next month (Jan 31 + 1 month = Mar 3). This tool clamps correctly, matching the behaviour of Python's dateutil.relativedelta, .NET's AddMonths, and SQL's DATEADD.

Frequently asked questions

How do I add days to a date?

Enter your start date, type the number of days, and make sure 'Add' is selected. The result updates instantly. Use the quick-add buttons for common durations like +7 days or +1 month.

What happens when I add 1 month to January 31?

The result is February 28 (or February 29 in a leap year). When adding months or years, the day is clamped to the last valid day of the target month. This matches the behaviour of most programming languages and databases.

How do I subtract days from a date?

Switch the toggle from 'Add' to 'Subtract', enter your amount and unit, and the result shows the earlier date.

What is the difference between adding 30 days and adding 1 month?

Adding 30 days always moves exactly 30 calendar days forward. Adding 1 month moves to the same day number in the next month, regardless of how many days that month has — so +1 month from March 15 is April 15 (31 days), but +1 month from April 15 is May 15 (30 days).

How does this work in code?

In JavaScript: new Date(date.setDate(date.getDate() + n)) for days. For months use date.setMonth(date.getMonth() + n), but beware: JS rolls over (Jan 31 + 1 month = Mar 3 in JS without clamping). In Python: datetime + timedelta(days=n) for days; dateutil.relativedelta(months=1) for calendar months with correct clamping.

Related tools

Smart paste

Paste any timestamp or date, or search for a tool