The Unix time stamp tracks time as a running count of seconds. The count begins at the "Unix Epoch" on January 1st, 1970, so a Unix time stamp is simply the total seconds between any given date and the Unix Epoch. Since a day contains 86400 seconds (24 hours x 60 minutes x 60 seconds), conversion to Excel time can be done by dividing days by 86400 and adding the date value for January 1st, 1970.
In the example shown, the formula first divides the time stamp value in B5 by 86400, then adds the date value for the Unix Epoch, January 1, 1970. The formula evaluates like this:
When C5 is formatted with the Excel date "d-mmm-yyyy", the date is displayed as 1-Oct-2018.
How Excel tracks dates time
The Excel date system starts on January 1, 1900 and counts forward. The table below shows the numeric values associated with a few random dates:
1-Oct-2018 12:00 PM
Notice the last date includes a time as well. Since one day equals 1, and one day equals 24 hours, time in Excel can represented as fractional values of 1, as shown in the table below. In order to see the value displayed as a time, a time format needs to be applied.
To convert a time in Excel's format to a Unix time stamp, you can use a formula based on the DATE function. In the example shown, the formula in C5 is: = ( B5 - DATE ( 1970 , 1 , 1 )) * 86400 How this formula works The Unix time stamp tracks time as...
To get the duration between two times in as decimal hour (i.e. 3 hrs, 4.5 hrs, 8 hrs, etc.) you can use a formula based on the MOD function. In the example shown, the formula in D5 is: = MOD ( B2 - A2 , 1 ) * 24 Excel hours In Excel, one day is the...
To calculate overtime and pay associated with overtime, you can use the formulas explained on this page. In formula in cell I5 is: = ( F5 * H5 ) + ( G5 * H5 * 1.5 ) How this formula works Note: it's important to understand that Excel deals with time...
To convert a time from one time zone to another, you can use a formula that converts hours entered as whole numbers to the decimal values that Excel recognizes as times. In the example shown, the formula in F5 is: = MOD ( C5 + ( E5 / 24 ), 1 ) This...
To calculate and display the days, hours, and minutes between two dates, you can use the TEXT function with a little help from the INT function . In the example shown, the formula in D5 is: = INT ( C5 - B5 ) & " days " & TEXT ( C5...
To calculate the number of hours between two times, you can use a formula that simply subtracts the start time from the end time. This is useful to calculate working time, calculate elapsed time, etc. However, when times cross a day boundary (...
To convert a valid Excel time into decimal seconds, you can multiply by 86400. In the example shown, the formula in C6 is: = B6 * 86400 which returns a value of 60, since there are 60 seconds in 1 minute. How this formula works In the Excel time...
The Excel DATE function creates a valid date from individual year, month, and day components. The DATE function is useful for assembling dates that need to change dynamically based on other values in a worksheet.
Excel Formula Training
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.