Quick Answer

HOUR Function

Returns the hour portion (0-23) of a time value.

✓ Excel✓ Google SheetsExcel All versions

Syntax

HOUR
(serial_number)

Parameters

ParameterDescriptionRequired
serial_numberA date-time serial (or a time fraction). The integer part is a date and the fractional part is the time; the hour is taken from the fractional part.Required

Basic Example

Get the hour from a time

=HOUR(TIME(12, 30, 0))
Result12

TIME(12,30,0) is 12:30 PM, so HOUR returns 12.

Advanced Examples

Example 1: Extract hour from a date-time serial

A timestamp like 2024-01-15 18:00

HOUR reads the fractional time part

=HOUR(45305.75)
Result: 18
The .75 fraction equals 18:00 (6 PM), so HOUR returns 18.

Example 2: Midnight returns 0

A date with no time component

A whole-number serial has no time fraction

=HOUR(45305)
Result: 0
45305 is exactly midnight 2024-01-15; with no time fraction HOUR returns 0.

How HOUR Works

HOUR takes the fractional part of the serial (the time-of-day component) and multiplies it by 24, then returns the integer hour from 0 (midnight) to 23 (11 PM). The date portion is ignored.

1
Reference a time value
Point HOUR at a cell or expression that holds a time or date-time.
2
Read the hour
The function returns an integer 0-23.

Important Notes & Limitations

  • HOUR ignores the date portion entirely.

  • A value with no time fraction (a whole number) returns 0, which can look wrong if you expected a time.

  • It accepts only valid serials; text times must be converted first.

Common Errors & Fixes

#VALUE!The argument is text that Excel cannot parse as a time.

Fix: Convert the text to a real time serial first (e.g. with TIMEVALUE).

Returns 0 unexpectedlyThe serial is a whole number with no time part.

Fix: Make sure the value actually contains a time fraction.

Download Practice File

Practice HOUR with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the HOUR function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Does HOUR work on a full date-time?
Yes, it reads only the time fraction, e.g. 2024-01-15 18:00 returns 18.
What about times after 23:59?
Times are stored as fractions under 1, so the maximum hour returned is 23.
Why do I get 0 for a date?
Dates without a time component have a zero fraction, so the hour is 0.