HOUR

Updated on

HOUR is a DAX function that returns the hour component from a datetime value, ranging from 0 to 23.

Syntax

HOUR( Datetime )
Argument Properties 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

  • The HOUR function takes as argument the time that contains the hour you want to find. You can supply the time by using a date/time function, an expression that returns a datetime, or by typing the value directly in one of the accepted time formats. Times can also be entered as any accepted text representation of a time.

  • When the datetime argument is a text representation of the date and time, the function uses the locale and date/time settings of the client computer to understand the text value in order to perform the conversion. Most locales use the colon (:) as the time separator and any input text using colons as time separators will parse correctly. Review your locale settings to understand your results.

Example 1

The following example returns the hour from the TransactionTime column of a table named Orders.

= HOUR('Orders'[TransactionTime])

Example 2

The following example returns 15, meaning the hour corresponding to 3 PM in a 24-hour clock. The text value is automatically parsed and converted to a date/time value.

= HOUR("March 3, 2008 3:00 PM")

Other functions related to HOUR are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/hour-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy