OpenBI Docs Buy

Time.From

Turns a value into a time of day: a datetime loses its date, a number's fraction is a part of a day.

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

Syntax

Time.From(value as any, optional culture as nullable text) as nullable time
ParameterTypeDescription
valueanyA time, datetime, datetimezone, number or text; null gives null.
culturenullable text
optional
A culture's name for reading text; left out, the query's culture.

Returns

nullable time. The time of day.

Remarks

  • A number is a part of a day, from 0 up to (not including) 1: 0.75 is 18:00, 0.5 noon. A number below 0 or from 1 up is an error: take the fraction first, as Time.From(x - Number.RoundDown(x)).
  • Text is read as Time.FromText reads it.
  • A datetimezone gives the time of day on the computer's clock: 14:30 at -05:00 is 20:30 in Oslo in winter. The computer's time zone is the one of the computer that runs the query, with its summer time: the studio's on your desk, the server's when a model refreshes there. These examples ran in Oslo (+01:00 in winter, +02:00 in summer).

Examples

Three quarters of a day

Time.From(0.75)
#time(18, 0, 0)

The time of a datetime

Time.From(#datetime(2024, 3, 15, 14, 30, 0))
#time(14, 30, 0)

Text from a timesheet

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

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

Last updated · OpenBI Studio 0.3.79