TIME

Updated on

TIME is a DAX function that converts hours, minutes, and seconds into a time value in datetime format.

Syntax

TIME(
   Hour,
   Minute,
   Second
)
Argument Properties Description
Hour A number from 0 to 23 representing the hour.
Minute A number from 0 to 59 representing the minute.
Second A number from 0 to 59 representing the second.

Return Values

A time (datetime) ranging from 00:00:00 (12:00:00 AM) to 23:59:59 (11:59:59 PM).

Remarks

  • In contrast to Microsoft Excel, which stores dates and times as serial numbers, DAX works with date and time values in a datetime format. Numbers in other formats are implicitly converted when you use a date/time value in a DAX function. If you need to use serial numbers, you can use formatting to change the way that the numbers are displayed.

  • Time values are a portion of a date value, and in the serial number system are represented by a decimal number. Therefore, the datetime value 12:00 PM is equivalent to 0.5, because it is half of a day.

  • You can supply the arguments to the TIME function as values that you type directly, as the result of another expression, or by a reference to a column that contains a numeric value.

  • Date and datetime can also be specified as a literal in the format dt"YYYY-MM-DD", dt"YYYY-MM-DDThh:mm:ss", or dt"YYYY-MM-DD hh:mm:ss". When specified as a literal, using the TIME function in the expression is not necessary. To learn more, see DAX Syntax | Date and time.

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Example 1

The following examples both return the time, 3:00 AM:

= TIME(27,0,0)
= TIME(3,0,0)

Example 2

The following examples both return the time, 12:30 PM:

= TIME(0,750,0)
= TIME(12,30,0)

Example 3

The following example creates a time based on the values in the columns, intHours, intMinutes, intSeconds:

= TIME([intHours],[intMinutes],[intSeconds])

Other functions related to TIME are:

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

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