Time.FromText is a Power Query M function that creates a time value from a text representation, with optional formatting and culture options. The function returns the time value corresponding to the provided textual representation.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365


   text as nullable text,
   optional options as any,
) as nullable time


Creates a time value from a textual representation, text. An optional record parameter, options, may be provided to specify additional properties. The record can contain the following fields:

  • Format: A text value indicating the format to use. For more details, go to https://go.microsoft.com/fwlink/?linkid=2180104 and https://go.microsoft.com/fwlink/?linkid=2180105. Omitting this field or providing null will result in parsing the time using a best effort.
  • Culture: When Format is not null, Culture controls some format specifiers. For example, in "en-US" "tt" is "AM" or "PM", while in "ar-EG" "tt" is "ص" or "م". When Format is nullCulture controls the default format to use. When Culture is null or omitted, Culture.Current is used.

To support legacy workflows, options may also be a text value. This has the same behavior as if options = [Format = null, Culture = options].


Convert "10:12:31am" into a Time value.

// Output: #time( 10, 12, 31 )
Time.FromText( "10:12:31am" )

Convert "1012" into a Time value.

// Output: #time( 10, 12, 00 )
Time.FromText( "1012" )

Convert "10" into a Time value.

// Output: #time( 10, 00, 00 )
Time.FromText( "10" )

Other functions related to Time.FromText are:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/time-fromtext
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.