Intermediate

Add or Subtract Time From a Date

Add or subtract any combination of years, months, weeks, days, hours, minutes and seconds from a starting date and time to find the resulting moment.
ISO format, e.g. 2026-06-27T09:00

yr

mo

wk

d

h

min

s

Resulting date and time
2027-09-06 15:30:00
Weekday
Monday
Starting date-time
2026-06-27 09:00:00
Total day shift
436.27 days
Total second shift
37,693,800 seconds
2026-06-27 09:00:002027-09-06 15:30:00436.27 daysTime span from starting date-time to result
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

Enter a base date-time and signed year, month, week, day, hour, minute and second offsets. The tool adds the year and month parts as calendar adjustments, then adds the remaining parts as a fixed millisecond span, returning the resulting date-time, its weekday, and the total shift in days and seconds.

Formula
result = base, then setFullYear(+Δy), setMonth(+Δmo), then + ((Δd + 7·Δw)·86400 + 3600·Δh + 60·Δmi + Δs)·1000 ms
How this is calculated

Start with a base date-time entered in ISO format (for example 2026-06-27T09:00). Each offset field accepts a positive value to add time or a negative value to subtract it. The calculation applies the offsets in two stages so the result matches everyday calendar expectations.

First the calendar parts are applied: the year offset is added with setFullYear and the month offset with setMonth. These respect variable month lengths and leap years, so "one month" lands on the same day-of-month where possible (with JavaScript Date normalising end-of-month overflow). After that the elapsed-time parts — weeks, days, hours, minutes and seconds — are converted to a single millisecond span using (Δd + 7·Δw)·86400 + 3600·Δh + 60·Δmi + Δs, multiplied by 1000, and added to the date.

The output shows the resulting date-time, its weekday, and the total shift expressed both in days and in seconds (the difference between the final and starting instants). Note the total-day and total-second figures are measured against the local time line, so transitions like daylight-saving changes in the host time zone can make the elapsed seconds differ slightly from the nominal offsets.

Frequently asked questions

Enter a negative number in any offset field. For example, type -3 in the Days field to move three days into the past. You can mix positive and negative offsets freely.

Months have different lengths, so the tool adjusts the calendar month rather than adding a fixed 30 days. Adding one month to January 31 lands in early March because February has fewer days, which is standard calendar behaviour.

Years and months are applied first as calendar adjustments, then weeks, days, hours, minutes and seconds are added as a fixed elapsed-time span. This ordering keeps month-end and leap-year results intuitive.

Also known as

add time to date
subtract time from date
date plus hours
time calculator
date math
add subtract time
date and time calculator
add hours to date

APA

TG we-Calculate Editorial Team. (2026). Add or Subtract Time From a Date [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/add-subtract-time

Chicago

TG we-Calculate Editorial Team. "Add or Subtract Time From a Date." TG we-Calculate. 2026. https://we-calculate.com/calculator/add-subtract-time.

IEEE

TG we-Calculate Editorial Team, "Add or Subtract Time From a Date," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/add-subtract-time

BibTeX

@misc{wecalculate_add_subtract_time, title = {Add or Subtract Time From a Date}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/add-subtract-time}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?