HOUR
Extracts the hour component (0 to 23) from a time or datetime serial.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=HOUR(serial_number)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
serial_number | number | Required | — |
Remarks
- A date argument may be text holding a date or time (
"10/26/1999","1999-10-26 14:05"), read as its serial; text that is neither a number nor a date returns#VALUE!. - For values
>= 1, only the fractional time part is used. - For values
< 1, the value is treated directly as a time fraction. - Date-system choice does not affect hour extraction because only the fractional part is used.
Examples
Extract the component from a time with nonzero hours, minutes and seconds.
Formula =HOUR(TIME(14,35,27))
Expected result 14
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Read the time component from a serial that also includes a date.
Formula =HOUR(DATE(2024,2,29)+TIME(14,35,27))
Expected result 14
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Read the component at midnight.
Formula =HOUR(0)
Expected result 0
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
An unrecognized time string cannot be converted to a serial.
Formula =HOUR("not a time")
Expected result #VALUE!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Extract hour from noon
Formula =HOUR(0.5)
Expected result 12
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Extract hour from datetime serial
Formula =HOUR(45351.75)
Expected result 18
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
Why is HOUR unchanged across 1900 and 1904 date systems?
HOUR reads only the fractional time component of a serial, so date-system epoch differences do not affect it.