How to Calculate the Time Between Two Dates and Times

From “how many days until…” to exact hours between two timestamps – the methods, the edge cases and the quick tools.

Updated 2026-10-12 · HourCalc guides

Skip the manual math: use the free Time Duration Calculator – instant results, nothing to install.

Open the Time Duration Calculator →

Counting the time between two moments sounds trivial until you try it: months have different lengths, leap years add a day, clocks change for daylight saving time and people disagree about whether to count the first day. This guide explains reliable methods for each kind of question, so you get the same answer a calculator would – and know why.

Decide what you are measuring

Before calculating, be clear about the question:

  • Elapsed time between two date-times – e.g., from 3 March 09:00 to 5 March 17:30. Answer in days, hours and minutes.
  • Number of calendar days between dates – e.g., how many days from 1 June to 15 August.
  • Working days – weekdays only, possibly excluding holidays.
  • Years, months and days – common for ages, tenure and contract lengths.

Skip the manual math: use the free Time Duration Calculator – instant results, nothing to install.

Open the Time Duration Calculator →

Method 1: Days between two dates

The cleanest method is to count from a fixed reference. Work out the day-of-year for each date and subtract, adjusting across years. Let's take 1 June to 15 August in a non-leap year:

  • Days remaining in June after the 1st: 29
  • July: 31
  • August up to the 15th: 15
  • Total: 29 + 31 + 15 = 75 days

That is the exclusive count (the start date isn't counted). If you need to count both the start and end days – for example, the number of days in a hotel stay or a leave period – add 1 for an inclusive count: 76 days. Always state which convention you used. The days between dates calculator shows both.

Method 2: Exact time between two date-times

Break it into whole days plus the remaining hours and minutes.

Example: from 3 March, 09:15 to 5 March, 17:40.

  1. From 3 March 09:15 to 5 March 09:15 is exactly 2 days.
  2. From 09:15 to 17:40 is 8 hours 25 minutes.
  3. Total: 2 days, 8 hours, 25 minutes = 56 hours 25 minutes = 56.42 hours.

If the end time of day is earlier than the start time of day, take one fewer whole day and add 24 hours to the end time before subtracting. From 3 March 18:00 to 5 March 07:30: 1 whole day (to 4 March 18:00), then 18:00 to 31:30 = 13 hours 30 minutes. Total: 1 day, 13 hours, 30 minutes.

The time duration calculator handles all of this, and the time calculator is useful for adding or subtracting durations.

Method 3: Years, months and days

Months vary between 28 and 31 days, so “months between dates” is defined by calendar position, not by a fixed number of days. The usual approach:

  1. Count full years from the start date.
  2. Then count full months.
  3. Then count the remaining days.

From 20 January 2024 to 5 March 2026: 2 full years (to 20 January 2026), 1 full month (to 20 February 2026), then 13 days to 5 March (February 2026 has 28 days: 8 days to the 28th plus 5) = 2 years, 1 month, 13 days. The age calculator uses this method.

Leap years

A leap year has 366 days, with 29 February. The rule: a year is a leap year if it is divisible by 4, except century years, which must be divisible by 400. So 2024 and 2028 are leap years, 2100 will not be, and 2000 was. If your date range includes 29 February, the day count includes it.

Time zones and daylight saving time

If the two times are in different time zones, convert both to the same zone (or to UTC) first. The time zone converter helps with this. Also watch for daylight saving changes: on the day clocks go forward, a “day” lasts 23 hours in local time, and on the day they go back, it lasts 25. For payroll and billing, an overnight shift that spans a clock change may be one hour longer or shorter than the clock times suggest.

Working days

To count business days, take the total days and remove weekends and any public holidays. Holiday calendars differ by country and region, so add your own list. The business days calculator excludes weekends automatically.

Practical uses

  • Billing a client for a project spanning several days – see how to calculate hours worked.
  • Deadlines and notice periods – check whether they are calendar days or working days.
  • Tracking shifts that span midnight on a time card.

Frequently asked questions

Do I include the start date when counting days?

It depends on the purpose. Standard elapsed-time counting excludes the start date. Counting periods like leave or stays often includes both start and end dates, which adds one day.

How many hours are in 3 days and 6 hours?

3 × 24 + 6 = 78 hours.

Why is my result one hour off?

The range probably crosses a daylight saving time change, or the two times are in different time zones. Convert both to the same zone first.

Skip the manual math: use the free Time Duration Calculator – instant results, nothing to install.

Open the Time Duration Calculator →