Skip to main content

Date Difference & Calculator

Count days between dates or add and subtract days, weeks, months, and years

Difference between dates

Calendar-day totals, unaffected by DST.

Choose two dates to compare.

Add or subtract time

Use a negative amount to subtract from the date.

Choose a base date to calculate an adjusted date.

Was this Date Difference & Calculator helpful?

Help us keep tools reliable, fast, and bug-free.

What you can do with Date Difference & Calculator

  • Calculate days between two dates
  • Add thirty days to a date

How this date and time calculation works

Count calendar days between two dates and calculate a future or past date by adding or subtracting days, weeks, months, or years.

Example input

{"startDate":"2024-02-28","endDate":"2024-03-01","adjustment":{"date":"2024-01-31","amount":1,"unit":"months"}}

Example output

{"direction":"future","totalDays":2,"weeks":0,"remainingDays":2,"totalHours":48,"adjustedDate":"2024-02-29"}

Practical workflow

  1. Set a start date and end date in the Difference between dates panel.
  2. Read the calendar-day count, direction, weeks-and-days breakdown, and equivalent hours.
  3. In Add or subtract time, set a starting date, enter a signed whole-number amount, and choose Days, Weeks, Months, or Years.
  4. Review the calculated date; use a negative amount to move backward.

Common use cases

  • Counting calendar days for event deadlines, launch dates, and personal plans.
  • Finding dates a fixed number of weeks or months before a project milestone.
  • Checking month-end date adjustments, such as adding one month to January 31.

Important notes and limitations

  • Date differences count calendar days, include weekends, and report the direction separately; they do not calculate business days.
  • Month and year adjustments clamp to the last valid day in the destination month (January 31 plus one month becomes February 28 or 29).
  • Uses UTC calendar-date arithmetic, so daylight-saving clock changes do not change a day count.

POSIX date & coreutils date arithmetic commands

Add 45 days to current date in GNU date

date -d '+45 days' '+%Y-%m-%d'

Performs calendar date arithmetic accounting for differing month lengths and leap years.

Calculate elapsed days between two dates in bash

echo $(( ($(date -d '2026-12-31' +%s) - $(date -d '2026-01-01' +%s)) / 86400 ))

Computes exact day count between timestamps by calculating Unix epoch second difference.

Leap years & daylight saving time (DST) transitions

23-hour or 25-hour day error across Daylight Saving Time (DST) shift

Cause: Assuming every day has exactly 86,400 seconds when adding milliseconds across spring/fall DST transitions.

Solution: Use calendar-aware libraries (date-fns / Temporal API) that operate on calendar days rather than fixed epoch offsets.

Continue your workflow

Frequently asked questions

Are weekends excluded from the date difference?

No. The result counts calendar days, including Saturdays and Sundays. It does not provide a business-day total.

Does the calculation account for leap years and February 29?

Yes. Calendar calculations use authentic Gregorian calendar rules, correctly identifying leap years and February 29 dates.

How do month additions work when the target month is shorter?

The date is clamped to the last valid day of the target month. For example, adding one month to January 31, 2024 returns February 29, 2024.