Whether you are working out how long ago a project started, calculating an employee’s length of service, figuring out a warranty expiry, or just satisfying your curiosity about how many days you have been alive, this time duration between two dates calculator gives you a precise, unambiguous answer in under two seconds.
How it works
The calculator takes a start date and an end date (with optional time-of-day) and computes the gap two different ways.
Calendar breakdown — the natural human reading. The algorithm walks forward from the earlier date: it counts complete years, then counts remaining complete months, then counts remaining days, then hours, minutes and seconds. Because months have different lengths (28, 29, 30 or 31 days depending on month and year), this cannot be done by simply dividing total days. The tool borrows correctly at each unit boundary, so “1 year, 1 month, 1 day” is always exact, not an approximation.
Totals in a single unit — useful for calculations. 1 year and 3 months is easy to read but awkward to multiply. The totals table converts the entire interval to days, weeks, hours, minutes, seconds and milliseconds so you can use the number directly in a spreadsheet or script. Copy buttons remove the thousands separator before copying so the raw integer is clipboard-ready.
The engine runs entirely in your browser using JavaScript’s native Date object, which handles leap years, daylight-saving transitions and calendar edge cases automatically. Nothing is sent to a server.
Worked example
Suppose a fixed-term contract runs from 1 January 2022 to 31 March 2024.
Calendar breakdown: 2 years, 2 months and 30 days.
Totals:
- Total days: 820
- Total weeks: 117 (whole weeks)
- Total hours: 19,680
- Total minutes: 1,180,800
Now add time-of-day: contract starts at 09:00 on 1 Jan 2022 and ends at 17:30 on 31 Mar 2024. The seconds-level totals update to reflect the extra 8.5 hours (30,600 seconds).
Formula note
All totals derive from the raw millisecond difference:
delta_ms = end_timestamp_ms − start_timestamp_ms
From there: total_seconds = floor(delta_ms / 1000), total_minutes = floor(delta_ms / 60000), total_hours = floor(delta_ms / 3600000), total_days = floor(delta_ms / 86400000), total_weeks = floor(total_days / 7).
The calendar decomposition uses iterative borrowing. Starting with raw (year, month, day, hour, minute, second) component differences, each unit is adjusted upward by borrowing from the next larger unit when negative — for example, if the day component is negative, one month is subtracted and the actual number of days in that month is added to the day component.
Quick-pick presets
Seven preset buttons let you jump to common intervals instantly: last 7 days, last 30 days, last 90 days, last year, next 30 days, next 90 days, next year. These are relative to today, so “last 30 days” always gives today’s correct date as the end.