OpenBI Docs Buy

DateTimeZone.ToLocal

Shows a datetimezone's instant in the computer's own time zone, with the offset it has there.

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

Syntax

DateTimeZone.ToLocal(dateTimeZone as nullable datetimezone) as nullable datetimezone
ParameterTypeDescription
dateTimeZonenullable datetimezoneThe value; null gives null.

Returns

nullable datetimezone. The same instant, at the computer's offset for that date.

Remarks

  • The offset follows the computer's summer time: in Oslo a winter date gets +01:00 and a summer date +02:00. 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).
  • For a fixed offset whatever the computer, use DateTimeZone.SwitchZone.

Examples

A UTC timestamp in Oslo

DateTimeZone.ToLocal(#datetimezone(2024, 3, 15, 13, 30, 0, 0, 0))
#datetimezone(2024, 3, 15, 14, 30, 0, 1, 0)

On a computer in Oslo: 14:30 at +01:00.

A New York order in summer

DateTimeZone.ToLocal(#datetimezone(2024, 7, 15, 9, 30, 0, -4, 0))
#datetimezone(2024, 7, 15, 15, 30, 0, 2, 0)

On a computer in Oslo: 15:30 at +02:00, summer time.

DateTimeZone.ToUtc, DateTimeZone.SwitchZone, DateTimeZone.LocalNow, DateTime.From.

Last updated · OpenBI Studio 0.3.79