OpenBI Docs Buy

Time.ToText

Writes a time of day as text, in the culture's short form or a format you give.

Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Time.ToText(time as nullable time, optional options as any, optional culture as nullable text) as nullable text
ParameterTypeDescription
timenullable timeThe time to write; null gives null.
optionsany
optional
A record [Format = ..., Culture = ...], both fields optional; or, as older queries do, a format as text.
culturenullable text
optional
A culture's name, when options is a format given as text.

Returns

nullable text. The time as text.

Remarks

  • Text follows the culture: the one given, else the query's (Culture.Current), which is the model's Locale for import, else the model's own culture, else en-US. These examples run in en-US unless a culture is given. Left without a format, en-US writes 2:30 PM, without seconds; nb-NO writes 14:30.
  • The letters of a format are those of DateTime.ToText: HH:mm:ss for a 24-hour clock with seconds.

Examples

The culture's short form

Time.ToText(#time(14, 30, 0))
"2:30 PM"

A 24-hour clock

Time.ToText(#time(14, 30, 0), [Format = "HH:mm"])
"14:30"

In Norwegian

Time.ToText(#time(14, 30, 0), [Culture = "nb-NO"])
"14:30"

Time.FromText, DateTime.ToText, Time.Hour.

Last updated · OpenBI Studio 0.3.79