OpenBI Docs Buy

DateTimeZone.SwitchZone

Shows the same instant in another time zone: the clock time moves with the offset.

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

Syntax

DateTimeZone.SwitchZone(dateTimeZone as nullable datetimezone, timezoneHours as number, optional timezoneMinutes as nullable number) as nullable datetimezone
ParameterTypeDescription
dateTimeZonenullable datetimezoneThe value to move; null gives null.
timezoneHoursnumberThe hours of the new offset.
timezoneMinutesnullable number
optional
The minutes of the new offset.

Returns

nullable datetimezone. The same instant with the new offset.

Remarks

  • The instant does not change, only how it is written: 14:30 at +01:00 is 08:30 at -05:00. To relabel a clock time without moving it, remove the zone and add another.

Examples

An Oslo order seen from New York

DateTimeZone.SwitchZone(#datetimezone(2024, 3, 15, 14, 30, 0, 1, 0), -5)
#datetimezone(2024, 3, 15, 8, 30, 0, -5, 0)

Seen from India

DateTimeZone.SwitchZone(#datetimezone(2024, 3, 15, 14, 30, 0, 1, 0), 5, 30)
#datetimezone(2024, 3, 15, 19, 0, 0, 5, 30)

DateTimeZone.ToUtc, DateTime.AddZone, DateTimeZone.RemoveZone.

Last updated · OpenBI Studio 0.3.79