DateTimeZone.SwitchZone
Changes the timezone of the value.
Syntax
DateTimeZone.SwitchZone(
dateTimeZone as datetimezone,
timezoneHours as number,
optional timezoneMinutes as number
) as datetimezone
Remarks
Changes timezone information to on the datetimezone value dateTimeZone
to the new timezone information provided by timezoneHours
and optionally timezoneMinutes
. If dateTimeZone
does not have a timezone component, an exception is thrown.
Examples
Example #1
Change timezone information for #datetimezone(2010, 12, 31, 11, 56, 02, 7, 30) to 8 hours.
DateTimeZone.SwitchZone(#datetimezone(2010, 12, 31, 11, 56, 02, 7, 30), 8)
Result:
#datetimezone(2010, 12, 31, 12, 26, 2, 8, 0)
Example #2
Change timezone information for #datetimezone(2010, 12, 31, 11, 56, 02, 7, 30) to -30 minutes.
DateTimeZone.SwitchZone(#datetimezone(2010, 12, 31, 11, 56, 02, 7, 30), 0, -30)
Result:
#datetimezone(2010, 12, 31, 3, 56, 2, 0, -30)
Category
DateTimeZone