Time.FromText
Reads a time of day from text, on a 24-hour clock or with AM and PM.
Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Time.FromText(text as nullable text, optional options as any) as nullable time
| Parameter | Type | Description |
|---|---|---|
text | nullable text | The text to read; null gives null. |
options | any optional | A record [Format = ..., Culture = ...], both fields optional, or a culture's name as text. Left out, the query's culture reads the text. |
Returns
nullable time. The time; an error when the text cannot be read.
Remarks
- Hours and minutes are enough; seconds and a fraction of a second may follow. AM and PM may be written after the time, with or without a space.
- The fields are separated as the culture separates them: a colon in en-US and nb-NO, a point in fi-FI. A format's other separators don't stand in for the culture's.
Examples
A 24-hour time
Time.FromText("14:30")
#time(14, 30, 0)
AM and PM
Time.FromText("2:30 PM")
#time(14, 30, 0)
Seconds with a fraction
Time.FromText("14:30:15.5")
#time(14, 30, 15.5)