Time.ToRecord
TimeConverts a time value to a record containing its parts.
Syntax
Time.ToRecord(time as time) as recordParameters
| Name | Type | Required | Description |
|---|---|---|---|
time | time | Yes | The time value to convert to a record. |
Return Value
record — A record with Hour, Minute, and Second fields.
Remarks
Time.ToRecord converts a time value into a record with the fields Hour, Minute, and Second. Each field contains the corresponding numeric component from the time value.
Examples
Example 1: Convert an OrderLog time to a record
let
FirstRow = Table.First(OrderLog),
TimeValue = DateTime.Time(FirstRow[Timestamp]),
Rec = Time.ToRecord(TimeValue)
in
#table(
type table [Hour = number, Minute = number, Second = number],
{{Rec[Hour], Rec[Minute], Rec[Second]}}
)Result
Hour | Minute | Second | |
|---|---|---|---|
| 1 | 9 | 30 | 0 |
Example 2: Convert a scalar time to a record
let
Rec = Time.ToRecord(#time(14, 30, 45))
in
#table(
type table [Hour = number, Minute = number, Second = number],
{{Rec[Hour], Rec[Minute], Rec[Second]}}
)Result
Hour | Minute | Second | |
|---|---|---|---|
| 1 | 14 | 30 | 45 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks