DAX Date & Time - TIME function


Advertisements

Description

Converts hours, minutes, and seconds given as numbers to a time in datetime format.

Syntax

TIME (<hour>, <minute>, <second>) 

Parameters

Sr.No. Parameter & Description
1

hour

A number from 0 to 23 representing the hour.

Any value greater than 23 will be divided by 24 and the remainder will be treated as the hour value.

2

minute

A number from 0 to 59 representing the minute.

Any value greater than 59 will be converted to hours and minutes.

3

second

A number from 0 to 59 representing the second.

Any value greater than 59 will be converted to hours, minutes, and seconds.

Return Value

Returns the specified time in datetime format.

Remarks

DAX works with date and time values in datetime format. Numbers in other formats are implicitly converted when you use a date/time value in a DAX function.

DAX TIME function takes the integers that are input as parameters and generates the corresponding time. The TIME function is most useful in situations where the hour, minute, and second are supplied by DAX formulas.

Time values are a portion of a date value, and in the serial number system are represented by a decimal number. Hence, the datetime value 12:00 PM is equivalent to 0.5, because it is half of a day. You can use DAX TIME function in conjunction with other DAX functions to convert the numbers to a format that can be recognized as a time.

Example

= TIME (2,90,30) returns 12/30/1899 3:30:30 AM. 
= TIME (12, 30, 0) returns 12/30/1899 12:30:00 PM 
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