Work out the gap between two dates

Measure the absolute elapsed interval between two parsed instants in independent total units.

freeworks offlinenothing uploaded
ToolDate Difference
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The absolute millisecond difference is floored into total seconds, minutes, hours, days, and weeks. Approximate months divide days by 30.44 and approximate years divide by 365.25 before rounding to two decimals.

  • Each line is a total in one unit, not a combined calendar years-months-days decomposition.
  • Input order is intentionally discarded, so the result has magnitude but no direction.

Worked example

Days Between Dates
Calculate the difference between two project milestones
Input
											Input1: 2025-01-15
Input2: 2025-06-30
										
Output
												From: 2025-01-15T00:00:00.000Z
To:   2025-06-30T00:00:00.000Z

Difference:
  0.45 years
  5.45 months
  23 weeks
  166 days
  3984 hours
  239040 minutes
  14342400 seconds
											

When to use this

Project reports count elapsed days, log investigations inspect total seconds, and rough plans express one duration in approximate months.

Edge cases

  • Reversing the two inputs produces the same positive interval.
  • A daylight-saving local interval can contain 23 or 25 elapsed hours between adjacent civil dates.
  • January 31 to February 28 is 28 days but only about 0.92 of the fixed 30.44-day month approximation.

References