TIMEDIFF (time difference)

<< Click to Display Table of Contents >>

TIMEDIFF (time difference)

Syntax:

TIMEDIFF(StartTime, EndTime)

Description:

Returns the time elapsed between two time values.

StartTime is the start time. EndTime is the end time.

Both can be either time values or date values including a time. Please note that in the latter case, both StartTime and EndTime have to include a date, otherwise a #VALUE! error value is returned.

Note:

Compared to simply subtracting time values, this function has the following advantage when EndTime is smaller than StartTime:

An employee starts his shift, for example, at 10:00 pm and leaves at 6:00 am. If calculating his hours of work by subtracting 10:00 pm from 6:00 am, the result would be -16 hours. If the TIMEDIFF function is used, the correct result (8 hours) is returned.

Example:

TIMEDIFF("8:00 AM", "4:00 PM") returns 8:00

TIMEDIFF("10:00 PM", "6:00 AM") returns 8:00

TIMEDIFF("10/01/2018 10:00 PM", "10/02/2018 6:00 AM") returns 8:00

Compatibility notes:

This function is not supported by Microsoft Excel. If you save a document in Excel format, all calculations using this function will be replaced by their last result as a fixed value.

See also:

TIME, TIMEVALUE, DAYS/DAYSP, DAYS360