Time.From

Time.From is a Power Query M function that converts various input values into a time value, with an optional culture parameter. The function returns a time value derived from the given input value.

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

Syntax

Time.From(
   value as any,
   optional culture as nullable text,
) as nullable time
ArgumentAttributeDescription
valueThe value to extract a time value from.
cultureoptionalThe culture argument enables the specification of a Culture code (e.g., “nl-NL” or “en-US”) to align transformations with local formatting conventions. If this argument is omitted, functions default to Culture.Current, which reflects the system’s regional settings.

Description

Returns a time value from the given value. An optional culture may also be provided (for example, “en-US”). If the given value is nullTime.From returns null. If the given value is timevalue is returned. Values of the following types can be converted to a time value:

  • text: A time value from textual representation. Refer to Time.FromText for details.
  • datetime: The time component of the value.
  • datetimezone: The time component of the local datetime equivalent of value.
  • number: A time equivalent to the number of fractional days expressed by value. If value is negative or greater or equal to 1, an error is returned.

If value is of any other type, an error is returned.

Examples

Convert 0.7575 to a time value.

// Output: #time( 18, 10, 48 )
Time.From( 0.7575 )

Convert #datetime( 1899, 12, 30, 06, 45, 12 ) to a time value.

// Output: #time( 06, 45, 12 )
Time.From( #datetime( 1899, 12, 30, 06, 45, 12 ) )

Other functions related to Time.From 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-from
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.