What is Date & Time Difference Calculator?
This date difference calculator tells you how much time lies between two moments. Choose a start date and time and an end date and time, and it shows the duration in days, weeks, hours and minutes, so you can answer questions like "how many days until the release?" or "how many hours did that incident last?" without counting on a calendar.
It works in both directions: if the end is before the start, you still get the positive duration between them. Developers use it for sprint and release planning, SLA and uptime calculations, token and certificate lifetimes, and checking date logic in their own code.
How to use Date & Time Difference Calculator
- Pick the start date and time.
- Pick the end date and time.
- Read the duration in days, weeks, hours and minutes.
- Adjust either date to compare other periods; the results update instantly.
Key features
- Duration in days, weeks, hours and minutes
- Date and time pickers for start and end
- Works whichever date comes first
- Results update instantly as you change the dates
- Uses your local time zone
Common use cases
- Counting days until a release, deadline or event
- Measuring incident duration for postmortems and SLA reports
- Checking token, session, trial and certificate lifetimes
- Planning sprints and project timelines
- Verifying date arithmetic in your own code
Technical details & standards
The calculator subtracts the two moments in milliseconds and converts the absolute difference into whole minutes, hours and days (rounded down), and weeks to one decimal place. Dates are entered in your device's local time zone.
Because the calculation uses exact elapsed time, a period that crosses a daylight-saving change is one hour shorter or longer than the calendar suggests; 1 day here always means 24 hours. For an inclusive count, subtract the calendar dates without their times, then add one. Adding one to the elapsed Days result can give the wrong count when times differ or the clocks change.
How to count the days between two dates by hand
To find the duration between two dates without a calculator, count what is left of the first month, add the whole months in between, then add the days of the last month. Here is 14 March 2026 to 2 November 2026:
- Days left in March after the 14th: 31 − 14 = 17.
- Whole months from April to October: 30 + 31 + 30 + 31 + 31 + 30 + 31 = 214.
- Days into November: 2.
- Add them: 17 + 214 + 2 = 233.
Result: There are 233 days between 14 March and 2 November 2026, or 33.3 weeks. That is the difference between the calendar dates. Counting both the first and last date gives 234 days. The tool measures elapsed time, which can differ if the times or UTC offsets differ.
Time between two dates in JavaScript and Python
In code, subtract one date from the other and divide by the length of a day. Using UTC or plain dates avoids an hour going missing over daylight saving changes.
JavaScript
const ms = Date.UTC(2026, 10, 2) - Date.UTC(2026, 2, 14); // months start at 0
ms / 86400000; // 233Date.UTC months run from 0 (January) to 11 (December), so 10 is November.
Python
from datetime import date, datetime
(date(2026, 11, 2) - date(2026, 3, 14)).days # 233
d = datetime(2026, 11, 2, 17, 30) - datetime(2026, 3, 14, 9, 0)
d # 233 days, 8:30:00
d.total_seconds() / 3600 # 5600.5 hoursFrequently asked questions
How do I calculate the number of days between two dates?
Pick the two dates as start and end; the tool shows the difference in days instantly. By hand, subtract the earlier date from the later one in milliseconds and divide by 86,400,000 (the milliseconds in a day).
Does the result include both the start and end day?
The tool measures elapsed time. From 1 June at noon to 3 June at noon, it shows 2 days if there is no clock change. Counting the calendar dates 1, 2 and 3 June gives 3 days.
How are daylight saving time changes handled?
The difference is exact elapsed time in your local time zone, so a span across a clock change gains or loses an hour. That is usually what you want for durations; calendar-day counts may differ by one in rare cases.
How many hours are in a week?
168 hours: 7 days × 24 hours. A 30-day month has 720 hours and a non-leap year has 8,760 hours, which is useful when converting uptime percentages into allowed downtime.
How many weeks are between two dates?
Divide the number of days by 7. The calculator shows the weeks for you.
How do I calculate the time between two dates and times?
Enter a time with each date. The result shows the exact duration in days, hours and minutes.
How do I count the days between two dates in Excel?
Subtract the dates: with the start date in A1 and the end date in B1, =B1-A1 returns the number of days. =DATEDIF(A1,B1,"d") does the same, and "m" or "y" in place of "d" gives whole months or years.
Does it matter which date I enter first?
No. The calculator measures the gap between the two moments, so a later start date simply gives the same duration as the dates swapped. That makes it handy for both counting down to a date and counting how long ago something happened.
Is my data safe?
Processing happens locally in your browser. Tool input is not sent to CodeUnpack servers.
Does it work offline?
Once the page has loaded, this tool can process input without an internet connection.