Skip to main content

Excel Formula: Calculate Days Hours Minutes seconds between Two Dates

Author: Sun Last Modified: 2020-08-27

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

Kutools for Excel - Helps You To Stand Out From Crowd

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...


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