HOUR
Return the hour, 0 to 23, from a time value.
Syntax
HOUR(serial_number) | Argument | Required | Description |
|---|---|---|
serial_number | Required | A time, expressed as a fraction of a day. |
Examples
Every example below was executed against VisiGrid engine 0.35.0 — not
transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.
| Formula | Result | Notes |
|---|---|---|
=HOUR(0.75) | 18 | Three quarters of a day is 18:00. |
=HOUR(DATE(2024,3,15)) | 0 | A date with no time component is midnight. |
=HOUR(TIME(18,30,0)) | 18 | TIME builds the fraction for you. |
Times are fractions of a day
0.5 is noon, 0.75 is six in the evening, 0.25 is six in the morning. A
date-with-time is the whole number for the date plus the fraction for the time,
which is why HOUR of a plain date returns 0.
TIME builds one from hours, minutes and seconds, which is far more legible
than writing the fraction yourself:
=HOUR(TIME(18,30,0)) → 18
Writing the arithmetic directly still works — 18.5/24 is the same value — but
TIME says what it means and handles the division for you.
Excel compatibility
Matches Excel.