DateTimeZone.SwitchZone

Modifies the timezone information of the `dateTimeZone` value to the new timezone specified by `timezoneHours` and, if applicable, `timezoneMinutes`. If `dateTimeZone` lacks a timezone component, an e...

Syntax

DateTimeZone.SwitchZone(dateTimeZone as nullable datetimezone, timezoneHours as number, optional timezoneMinutes as nullable number) as nullable datetimezone

About

Modifies the timezone information of the `dateTimeZone` value to the new timezone specified by `timezoneHours` and, if applicable, `timezoneMinutes`. If `dateTimeZone` lacks a timezone component, an exception will be raised.

Explanation

Modify the time zone information of #datetimezone(2010, 12, 31, 11, 56, 02, 7, 30) by adding 8 hours. Instructions: Use the Power Query MDateTimeZone.SwitchZone function with the parameters (#datetimezone(2010, 12, 31, 11, 56, 02, 7, 30), 8). Result: #datetimezone(2010, 12, 31, 12, 26, 2, 8, 0) Adjust the time zone information of #datetimezone(2010, 12, 31, 11, 56, 02, 7, 30) by subtracting 30 minutes. Instructions: Use the Power Query MDateTimeZone.SwitchZone function with the parameters (#datetimezone(2010, 12, 31, 11, 56, 02, 7, 30), 0, -30). Result: #datetimezone(2010, 12, 31, 3, 56, 2, 0, -30)