DAX Date & Time - HOUR function


Advertisements

Description

Returns the hour as an integer from 0 (12:00 A.M.) to 23 (11:00 P.M.).

Syntax

HOUR (<datetime>) 

Parameters

Sr.No. Parameter & Description
1

datetime

A datetime value representing time. E.g. 18:15:00 or 6:48 P.M.

Return Value

An integer from 0 to 23.

Remarks

The parameter to the DAX HOUR function is the time that contains the hour you want to find.

You can specify the time as one of the following −

  • An output of a date/time function.
  • An expression that returns a datetime value.
  • A value in one of the accepted time formats.
  • An accepted text representation of a time.

The HOUR 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

= HOUR ("18:15:15") returns 18. 
= HOUR ("6:15:15") returns 6. 
= HOUR (NOW ()) returns 9, if NOW () returns 12/16/2016 9:02:12 AM. 
dax_functions_date_time.htm

Useful Video Courses


Video

Mastering DAX and Data Models in Power BI Desktop

53 Lectures 5.5 hours

Abhay Gadiya

Video

Mastering DAX Studio

Featured

24 Lectures 2 hours

Randy Minder

Video

DAX / Power BI - Customer and Sales Analysis Deep Dive

26 Lectures 4.5 hours

Randy Minder

Advertisements