Documentation/Calc Functions/TIME

Function name:
TIME

Category:
Date and Time

Summary:
Calculates the time (as the fractional part of a date-time serial number) for given hours, minutes, and seconds values.

Syntax:
TIME(Hour; Minute; Second)

Returns:
Returns a real number (0 ≤ x < 1) which is the fractional part of the date-time serial number calculated using the given arguments. The returned value is formatted as a time by default, but you can apply other formats as needed.

Arguments:
Hour is a real number or a reference to a cell containing that value, which is the hours value to be used. Both positive and negative values are accepted along with values outside the normal range of 0 to 23.

Minute is a real number or a reference to a cell containing that value, which is the minutes value to be used. Both positive and negative values are accepted; values outside the normal range of 0 to 59 result in carry over to the calculated hours value.

Second is a real number or a reference to a cell containing that value, which is the seconds value to be used. Both positive and negative values are accepted; values outside the normal range of 0 to 59 result in carry over to the calculated minutes value.


 * If any of Hour, Minute, or Second is non-numeric, then TIME reports a #VALUE! error.
 * If no value is provided for any argument (for example, ), then TIME applies a default value of 0 for that argument.
 * If the value calculated is negative, then TIME returns an invalid argument error (Err:502).

Details specific to TIME function
The formula for TIME is:


 * TIME = MOD(((HOUR*60*60) + (MINUTE*60) + SECOND), (24*60*60)) / (24*60*60)

TIME does not convert argument values to integers before doing its calculations. This approach may be the cause of some minor differences between the results from the TIME functions of Calc and Microsoft Excel. However, both approaches are compliant with ODF 1.2.

Related LibreOffice functions:
DATE

ODF standard:
Section 6.10.17, part 2

Equivalent Excel functions:
TIME