Time.From
TimeConverts a value to a time.
Syntax
Time.From(value as any, optional culture as nullable text) as nullable timeParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | any | Yes | The value to convert. Accepts text, datetime, datetimezone, and number values. |
culture | text | No | Culture code for locale-specific parsing (e.g., "en-US"). |
Return Value
time — A time value converted from the given input.
Remarks
Time.From converts text, datetime, datetimezone, or number values into a time. Text values are parsed according to standard time formats or the specified culture. Number values are interpreted as fractional days (e.g., 0.5 represents 12:00:00 PM). If the input is null, the function returns null.
Examples
Example 1: Extract time from OrderLog Timestamp
Table.AddColumn(
Table.SelectColumns(
Table.FirstN(OrderLog, 5),
{"LogID", "Timestamp"}
),
"TimeOnly", each Time.From([Timestamp]), type time
)Result
LogID | Timestamp | TimeOnly | |
|---|---|---|---|
| 1 | L001 | 1/15/2024 9:30:00 AM | 09:30:00 |
| 2 | L002 | 1/16/2024 2:15:00 PM | 14:15:00 |
| 3 | L003 | 1/18/2024 11:00:00 AM | 11:00:00 |
| 4 | L004 | 1/20/2024 8:45:00 AM | 08:45:00 |
| 5 | L005 | 2/1/2024 4:20:00 PM | 16:20:00 |
Example 2: Convert a text string to a time
#table(
type table [Result = time],
{{Time.From("14:30:00")}}
)Result
Result | |
|---|---|
| 1 | 14:30:00 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks