This article describes the formula syntax and usage of the HOUR function in Microsoft Excel.
Description
Returns the hour of a time value. The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
Syntax
HOUR(serial_number)
The HOUR function syntax has the following arguments:
- Serial_number Required. The time that contains the hour you want to find. Times may be entered as text strings within quotation marks (for example, “6:45 PM”), as decimal numbers (for example, 0.78125, which represents 6:45 PM), or as results of other formulas or functions (for example, TIMEVALUE(“6:45 PM”)).
Remark
Time values are a portion of a date value and represented by a decimal number (for example, 12:00 PM is represented as 0.5 because it is half of a day).
Example
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.
Time | ||
0.75 | ||
7/18/2011 7:45 | ||
4/21/2012 | ||
Formula | Description | Result |
=HOUR(A2) | Returns 75% of 24 hours | 18 |
=HOUR(A3) | Returns the hour portion of the date/time value. | 7 |
=HOUR(A4) | A date with no time portion specified is considered 12:00 AM, or 0 hours. | 0 |
Leave a Reply