ID EN
#Date and time

HOUR

Excel Functions

Get the hour as a number (0-23) from a Time

Syntax

EXCEL
=HOUR(serial_number)

Arguments

Parameter Description
serial_number A valid Excel time.

Return Value

A number between 0 and 23.

Details

The HOUR function returns the hour portion of a time as a number between 0-23. For example, with a time of 9:00 AM, HOUR will return 9. HOUR takes just one argument, serial_number, which must be a valid Excel date or a valid Excel time. Times can be supplied to the HOUR function as text (e.g. "7:45 PM") or as decimal numbers (e.g. 0.5, which equals 12:00 PM). To create a time value from scratch with separate hour, minute, and second inputs, use the TIME function. The HOUR function will "reset" to 0 every 24 hours (like a clock). To work with hour values larger than 24, use a formula to convert time to decimal hours. The HOUR function returns the hour from of a time or date as a number between 0-23. For example: The HOUR function ignores minutes and seconds. For example, when given the time

Examples

Example #1 - Hour from time

The HOUR function returns the hour from of a time or date as a number between 0-23. For example:

EXCEL
=HOUR("9:00 AM") // returns 9
=HOUR("9:00 PM") // returns 21
Example #2 - Minutes ignored

The HOUR function ignores minutes and seconds. For example, when given the time "6:30 PM", HOUR returns 18:

EXCEL
=HOUR("6:30 PM") // returns 18
Example #3 - Hour from date

Some Excel dates include time. When given a date that includes time, the HOUR function will extract the hour and ignore the date. For example, with 29

EXCEL
=HOUR(A1) // returns 6
Example #4 - with TIME function

You can use the HOUR function to extract the hour and feed the result into another formula, like the TIME function. For example, with the time "8:00 A

EXCEL
=TIME(HOUR(A1),30,0) // returns 8:30 AM

See Also

HOUR MINUTE SECOND TIME