HOUR Function

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

Syntax

HOUR(<datetime>)

Parameters

Term

Definition

datetime

A datetime value, such as 16:48:00 or 4:48 PM.

Return Value

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

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

=HOUR('Orders'[TransactionTime])

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")

See Also

Reference

MINUTE Function

YEAR Function

SECOND Function

Other Resources

Date and Time Functions (DAX)