Time.ToRecord is a Power Query M function that converts a time value into a record containing its parts. The function returns a record with the parts of the given time value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Time.ToRecord( time as time ) as record
Description
The Time.ToRecord function splits a time value into its hour, minute, and second components and stores them in a record format.
Examples
To extract the different components of a time value and store them within a record, you can apply the Time.ToRecord function on a time value. This function will split the time into its hour, minute, and second components and store them in a record format.
Here’s how you can store each component of the #time( 14, 30, 45 )
value in a record:
// Output: [ Hour = 14, Minute = 30, Second = 45 ]
Time.ToRecord( #time( 14, 30, 45 ) )
In this example, the function converts the time 14:30:45
into a record with the following components:
- Hour: 14
- Minute: 30
- Second: 45
This output makes it easy to access and use individual parts of the time separately in subsequent steps of your query.
Related functions
Other functions related to Time.ToRecord are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy