#time
TimeCreates a time value from hour, minute, and second components.
Syntax
#time(hour as number, minute as number, second as number) as timeParameters
| Name | Type | Required | Description |
|---|---|---|---|
hour | number | Yes | The hour component (0–23). |
minute | number | Yes | The minute component (0–59). |
second | number | Yes | The second component (0–59, can include fractional seconds). |
Return Value
time — A 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 | |
|---|---|
| 1 | 14: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 | |
|---|---|
| 1 | 3/15/2024 2:30:00 PM |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks