Date & Time

HOUR Formula

HOUR extracts the hour component (0-23) from a time or datetime value. It returns an integer from 0 (midnight) to 23 (11 PM). Use it to classify timestamps by hour, create hourly summaries, or extract the time portion of a datetime for conditional logic.

Syntax

HOUR(serial_number)
ParameterDescription
serial_number Parameter of the HOUR function.
Try HOUR in Viztab — free, no signup

Examples

Get hour from time

Formula
=HOUR("2:30 PM")
Returns 14 — the 24-hour equivalent of 2:30 PM.

Classify by time of day

Formula
=IF(HOUR(A1)<12, "Morning", IF(HOUR(A1)<17, "Afternoon", "Evening"))
Classifies timestamps: before noon is Morning, noon-5 PM is Afternoon, after 5 PM is Evening.

Extract from datetime

Formula
=HOUR("2026-04-09 15:45:00")
Returns 15 — extracts just the hour component from a full datetime value, ignoring the date and minutes.

Common Errors

#VALUE!

Occurs when the argument is text that cannot be interpreted as a time or datetime value.

Tips

Returns 0-23

HOUR always returns in 24-hour format. 12:00 AM = 0, 12:00 PM = 12, 11:00 PM = 23. There is no AM/PM variant.

Pair with MINUTE and SECOND

Use HOUR, MINUTE, and SECOND together to decompose any time value into its components for custom formatting or arithmetic.

Hourly grouping

=HOUR(A1) as a pivot field or SUMIFS criteria groups data by hour of day. Great for analyzing peak hours in transaction data.

Try HOUR in Viztab

Import your data and use HOUR with 370+ other formulas. No signup required.

Open Viztab

Related Formulas