HOUR DAX Function (Date and Time)
Returns the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.).
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| Datetime |
A datetime value or text in time format, such as 16:48:00 or 4:48:00 PM. |
Return values
An integer number from 0 to 23.
Remarks
HOUR returns the hour of the time part of Datetime, with a 24-hour clock. For example, HOUR ( “4:48:00 PM” ) returns 16 and HOUR ( “12:30 AM” ) returns 0. If Datetime is a date without a time, HOUR returns 0. If Datetime is BLANK, HOUR returns BLANK.
Datetime can be a number. The integer part of the number is the date, and the decimal part is the time. For example, HOUR ( 0.75 ) returns 18, because 0.75 is 18:00.
Datetime can also be a text that contains a time, such as “16:48:00” or “March 3, 2008 3:00 PM”. DAX converts the text to a date/time value with the locale settings, so the result can depend on the locale. If DAX cannot convert the text, HOUR returns an error. For example, HOUR ( “25:00” ) returns an error.
Examples
-- Extract time parts from a DateTime column
EVALUATE
ADDCOLUMNS (
TOPN ( 10, VALUES ( Sales[Order Time] ) ),
"Hour", HOUR ( Sales[Order Time] ),
"Minute", MINUTE ( Sales[Order Time] ),
"Second", SECOND ( Sales[Order Time] )
)
| Order Time | Hour | Minute | Second |
|---|---|---|---|
| 01:14:19 | 1 | 14 | 19 |
| 02:14:19 | 2 | 14 | 19 |
| 03:14:19 | 3 | 14 | 19 |
| 04:14:19 | 4 | 14 | 19 |
| 06:14:19 | 6 | 14 | 19 |
| 07:14:19 | 7 | 14 | 19 |
| 08:14:19 | 8 | 14 | 19 |
| 09:14:19 | 9 | 14 | 19 |
| 11:14:19 | 11 | 14 | 19 |
| 12:14:19 | 12 | 14 | 19 |
-- HOUR accepts a datetime, a number or a text.
-- With a number, the integer part is the date and
-- the decimal part is the time: 0.75 is 18:00.
-- A date without time returns 0. BLANK returns BLANK.
-- A text that is not a valid time returns an error.
EVALUATE
SELECTCOLUMNS (
{
( 1, "TIME ( 15, 30, 0 )", HOUR ( TIME ( 15, 30, 0 ) ) ),
( 2, "DATE ( 2026, 11, 25 ) + TIME ( 9, 15, 0 )", HOUR ( DATE ( 2026, 11, 25 ) + TIME ( 9, 15, 0 ) ) ),
( 3, "DATE ( 2026, 11, 25 )", HOUR ( DATE ( 2026, 11, 25 ) ) ),
( 4, "0.75", HOUR ( 0.75 ) ),
( 5, "45000.25", HOUR ( 45000.25 ) ),
( 6, """4:48:00 PM""", HOUR ( "4:48:00 PM" ) ),
( 7, """12:30 AM""", HOUR ( "12:30 AM" ) ),
( 8, """March 3, 2008 3:00 PM""", HOUR ( "March 3, 2008 3:00 PM" ) ),
( 9, "BLANK ()", HOUR ( BLANK () ) ),
( 10, "IFERROR ( HOUR ( ""25:00"" ), -1 )", IFERROR ( HOUR ( "25:00" ), -1 ) )
},
"#", [Value1],
"Argument", [Value2],
"HOUR", [Value3]
)
ORDER BY [#]
| # | Argument | HOUR |
|---|---|---|
| 1 | TIME ( 15, 30, 0 ) | 15 |
| 2 | DATE ( 2026, 11, 25 ) + TIME ( 9, 15, 0 ) | 9 |
| 3 | DATE ( 2026, 11, 25 ) | 0 |
| 4 | 0.75 | 18 |
| 5 | 45000.25 | 6 |
| 6 | “4:48:00 PM” | 16 |
| 7 | “12:30 AM” | 0 |
| 8 | “March 3, 2008 3:00 PM” | 15 |
| 9 | BLANK () | (Blank) |
| 10 | IFERROR ( HOUR ( “25:00” ), -1 ) | -1 |
Related functions
Other related functions are:
Last update: Nov 26, 2026 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://learn.microsoft.com/en-us/dax/hour-function-dax