Time Difference Calculator

Calculate the time between two dates and times, each in its own time zone. See the difference in years, months, days, hours, minutes, seconds and milliseconds. Set a max unit to get totals instead, such as the number of days or hours between two dates.

About this tool

What does this calculator do?

It subtracts one date and time from another and breaks the result into calendar units. Each date has its own time zone and display format, so you can compare, for example, a departure time in Tokyo with an arrival time in New York. The result is always Date1 - Date2.

How to use

  1. In Date1, enter a date in Date time or pick one with the calendar icon. Adjust Format if you want to type dates in another style, and choose a Timezone.
  2. Do the same for Date2.
  3. Read the result under Date1 - Date2: Years, Months, Days, Hours, Minutes, Seconds and Milliseconds.
  4. Use Max unit to choose the largest unit. For example, select Day to see the total number of days instead of years and months, or Hour to see the total hours.

Features

  • Difference down to the millisecond
  • Separate time zone for each date, with daylight saving time taken into account
  • Max unit from Year down to Millisecond, for totals in a single unit
  • Custom input format for each date (Day.js tokens such as YYYY-MM-DD HH:mm:ss)
  • Negative results when Date1 is earlier than Date2
  • Dates, formats and time zones are kept in this browser

How the difference is counted

Years, months and days are counted on the calendar: the calculator adds whole months to Date2 as long as it does not pass Date1, then whole days, and then measures the remaining hours, minutes, seconds and milliseconds as real elapsed time. Units larger than Max unit are not used and are greyed out.

Examples

Date1Date2Max unitResult
2023-01-15 14:302023-01-01 10:00Year14 days 4 hours 30 minutes
2023-01-15 14:302023-01-01 10:00Hour340 hours 30 minutes
2024-03-01 12:002024-02-28 12:00Year2 days (2024 is a leap year)
2023-02-28 00:002023-01-31 00:00Year1 month
2024-01-10 10:00 Asia/Tokyo2024-01-10 10:00 America/New_YorkYear-14 hours

FAQ

Why is the result negative?

The result is Date1 minus Date2. If Date1 is earlier, every value is zero or negative. Swap the dates if you want a positive result.

How do I get the total number of days between two dates?

Set Max unit to Day. The Days field then shows the full count of days, and the smaller fields show the remaining hours, minutes and seconds.

Why is January 31 to February 28 counted as one month?

Adding one month to January 31 lands on the last day of February, because February has no 31st. The calculator follows this calendar rule, so the difference is exactly 1 month.

What happens when I change a time zone?

The date and time you entered stay the same, but they are now read as local time in the new zone, so they point to a different moment and the difference changes. This is how you compare local times in different places.