#time

Time

Creates a time value from hour, minute, and second components.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

#time(hour as number, minute as number, second as number) as time

Parameters

NameTypeRequiredDescription
hournumberYesThe hour component (0–23).
minutenumberYesThe minute component (0–59).
secondnumberYesThe second component (0–59, can include fractional seconds).

Return Value

timeA time value representing the specified time of day.

Remarks

#time is M's literal constructor for creating time values — a time of day with no date or timezone component.

The second argument can include fractional seconds (e.g. 30.5). Out-of-range values (hour > 23, minute > 59, etc.) produce an error.

A time value has no date part. To combine a date and a time into a datetime, use addition: #date(2024, 3, 15) + #time(14, 30, 0) returns #datetime(2024, 3, 15, 14, 30, 0).

Examples

Example 1: Create a time literal

#time(14, 30, 0)
Result
Result
114:30:00

Example 2: Extract hour, minute, and second

let
    t = #time(14, 30, 45),
    h = Time.Hour(t),
    m = Time.Minute(t),
    s = Time.Second(t)
in
    {h, m, s}
Result
Result
1{14, 30, 45}

Example 3: Combine date and time into a datetime

#date(2024, 3, 15) + #time(14, 30, 0)
Result
Result
13/15/2024 2:30:00 PM

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks