TIME DAX Function (Date and Time)

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

Syntax

TIME ( <Hour>, <Minute>, <Second> )
Parameter Attributes 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

Scalar A single datetime value.

Returns the specified time.

Remarks

Each argument can have a value larger than the possible number of hours/minutes/seconds. However, the maximum number accepted in each argument is 32,767. Therefore, you cannot convert any number of seconds in the corresponding time of the day (one day has 86,400 seconds, the maximum value for the Seconds argument is 32,767).

» 1 related function

Examples

--  DATE and TIME are useful to create DateTime columns
--  A DateTime is a number. Therefore, it is possible to
--  sum the date and the time part.
EVALUATE 
    {
        DATE ( 2020, 10, 15 ),
        TIME ( 22, 45, 30 ),
        DATE ( 2020, 10, 15 ) + TIME ( 22, 45, 30 )
    }
Value
2020-10-15 00:00:00
1899-12-30 22:45:30
2020-10-15 22:45:30
--  When the arguments overflow their range, DATE and TIME
--  behave in different ways:
--
--  DATE adds the excess values to the date, moving time forward
--  TIME adds the excess values, but it does never exceed the day
EVALUATE 
    {
        DATE ( 2020, 10, 32 ),
        DATE ( 2020, 20, 1 ),
        TIME ( 10, 90, 0 ),
        TIME ( 50, 0, 0 )
    }
Value
2020-11-01 00:00:00
2021-08-01 00:00:00
1899-12-30 11:30:00
1899-12-30 02:00:00

Related functions

Other related functions are:

Last update: Mar 13, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Maxim Zelensky, Kenneth Barber,

Microsoft documentation: https://docs.microsoft.com/en-us/dax/time-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of TIME? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.