Skip to main content

Excel Formula: Calculate Days Hours Minutes seconds between Two Dates

doc calculate difference between time 5

General in Excel, we use formulas to count the difference between two dates in days or difference between two times. However, in some special cases, we may want to get the days, hours, minutes, and seconds between two datetimes, this tutorial introduces the formula to solve this job.

If you want to follow along with this tutorial, please download the example spreadsheet.
doc calculate difference between time 5

Generic formula:

INT(end_datetime-start_datetime)&" days "&TEXT(end_datetime-start_datetime,"h"" hrs ""m"" mins ""s"" secs""")


End_datetime, start_datetime: the two dates that you to calculate the difference between.


If the argument end_datetime is smaller than the argument start_datetime, the formula will return the error value #VALUE!.

Return value

This formula returns a text value.

How this formula work

To get the difference between two datetimes in cell B3 and cell C3, please use below formula:

=INT(C3-B3)&" days "&TEXT(C3-B3,"h"" hrs ""m"" mins ""s"" secs""")

Press Enter key to get the result.
doc calculate difference between time 5


INT function: The INT function returns the integer part of a decimal number.

As the date is stored as serial whole number in Excel, and the time is stored as serial decimal number which is less than 1 in Excel, and the datetime is stored as a serial decimal number, for instance, the datetime 12/1/2019 13:23:11 is stored as 43800.5577662037 in Excel. Here the INT function extracts the whole number part of the difference between two datetimes to get the difference in days.

TEXT function: This function is used to convert number to text with a specified format.

&: This is a connector that connects the results of each part in the formula.

Tip: To get the total days, hours, minutes, and seconds between a set of start and end dates, you can adapt the formula using SUMPRODUCT function:

=INT(SUMPRODUCT(ends-starts))&" days "&TEXT(SUMPRODUCT(ends-starts),"h"" hrs ""m"" mins """)

The argument ends is the range of end dates, the starts is the cell range of start dates, for example, range C3:C5 contains the end dates, B3:B5 contains the start dates, please using the formula like this:

=INT(SUMPRODUCT(C3:C5-B3:B5))&" days "&TEXT(SUMPRODUCT(C3:C5-B3:B5),"h"" hrs ""m"" mins """)

Press Enter key.
doc calculate difference between time 5

Relative Formulas

Relative Functions

The Best Office Productivity Tools

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations