How to Add or Subtract Days from a Date

Learn how calendar math works when adding or subtracting days, weeks, and months from a starting date.

Time & Date4 min read

Adding or subtracting a few days from today's date seems simple, but date math can get incredibly complex when you start crossing month boundaries, accounting for leap years, and adjusting for time zones.

Introduction to Date Math

Our calendar system (the Gregorian calendar) is notoriously irregular. We have 12 months, but they are not all the same length. February is particularly tricky, as it changes length every four years.

Adding Days and Weeks

Adding exactly 7 days (or 1 week) is straightforward because weeks always have 7 days. However, adding 30 days is NOT the same as adding 1 month. Depending on the month you start in, adding 30 days might push you into the next month early, or leave you a day short.

Want to jump forward or backward in time?

Use our calculator to add or subtract days, weeks, months, or years without worrying about leap years or month lengths.

Open Date Calculator

The Complexity of Adding Months

When software engineers build systems to add 1 month to a date, they usually increment the month value while keeping the day the same (e.g., Jan 15th + 1 month = Feb 15th). But what happens if you add 1 month to January 31st?

February 31st does not exist. Standard logic dictates that the date snaps to the last valid day of the target month (February 28th, or February 29th in a leap year). Because of these edge cases, it is highly recommended to use automated tools rather than guessing.

Frequently Asked Questions

Why is adding a month tricky?

Because months have different lengths (28, 29, 30, or 31 days). Adding 1 month to Jan 31st results in the last day of February.

More Content You Might Like