OpenBI Docs Buy

TIME

A time from hours, minutes and seconds; past a day the hours wrap round.

Group: Date and time. Compatible with DAX.

Syntax

TIME ( <hour>, <minute>, <second> )
ParameterTypeDescription
hourWhole numberThe hour, 0 to 23; past 23 it wraps round past midnight.
minuteWhole numberThe minutes; 60 or more carry into the hours.
secondWhole numberThe seconds; 60 or more carry into the minutes.

Returns

Date and time. That time of day, on 30 December 1899, day 0 of the date numbers.

Remarks

  • A time is a fraction of a day: 12:00 is 0.5. Add it to a date for a date with a time, as DATE ( 2024, 3, 15 ) + TIME ( 14, 30, 0 ).
  • Past 24 hours the whole days are dropped: TIME ( 25, 0, 0 ) is 01:00.
  • Each argument must lie between −32768 and 32767, so TIME ( 0, 0, 86399 ) is an error: write TIME ( 23, 59, 59 ). The total must not be negative either: TIME ( 1, -30, 0 ) is 00:30, but TIME ( -1, 0, 0 ) is an error.
  • A decimal is rounded, and a blank counts as 0.

Examples

Carrying over

EVALUATE
ROW (
    "25 hours", TIME ( 25, 0, 0 ),
    "90 minutes past noon", TIME ( 12, 90, 0 ),
    "3600 seconds", TIME ( 0, 0, 3600 )
)
25 hours90 minutes past noon3600 seconds
1899-12-30 01:00:001899-12-30 13:30:001899-12-30 01:00:00

A shift and its length

The difference of two times is in days; times 24, in hours.

EVALUATE
ROW (
    "Start", DATE ( 2024, 3, 15 ) + TIME ( 8, 0, 0 ),
    "End", DATE ( 2024, 3, 15 ) + TIME ( 16, 30, 0 ),
    "Hours", ( TIME ( 16, 30, 0 ) - TIME ( 8, 0, 0 ) ) * 24
)
StartEndHours
2024-03-15 08:00:002024-03-15 16:30:008.5

DATE, TIMEVALUE, HOUR, MINUTE, SECOND.

Last updated · OpenBI Studio 0.3.74