Documentation/Calc Functions/HOUR/en

Function name:
HOUR

Category:
Date and Time

Summary:
Determines the hour value from a date expression passed as a date-time serial number or a text string.

Syntax:
HOUR(DateTime)

Returns:
Returns a positive integer in the range 0 to 23, which is the hour value of the given date expression.

Arguments:
DateTime is the date expression (in quotation marks) or a date-time serial number, or a reference to the cell containing one of those types, from which the hour is to be extracted.


 * If DateTime does not contain a valid date expression, then HOUR reports a #VALUE! error.
 * If DateTime does not contain any time component, then HOUR returns 0 (time 00:00:00).

Details specific to HOUR function
The equation for HOUR is:
 * HOUR = INT(DayFraction * 24)

where,
 * DayFraction = DateTime – INT(DateTime)

Take care to understand the function’s behaviour if you ever need to pass date expressions corresponding to negative date-time serial numbers to HOUR (these are dates prior to that selected as the base date on the dialog). For example, if you pass a positive date-time serial number with a fractional part of 0.25 to HOUR, then it will return the value 6 (time 06:00:00). However, if you pass a negative date-time serial number with a fractional part of 0.25 to HOUR, then it will return the value 18 (time 18:00:00).

Visit Wikipedia’s 24-hour clock page if you need further background information about that topic.

Related LibreOffice functions:
DAY

MINUTE

MONTH

SECOND

ODF standard:
Section 6.10.10, part 2

Equivalent Excel functions:
HOUR