UtcOffset Procedure

Calculates the difference between UTC and another time zone for a particular local time.
Declaration
function UtcOffset(
dateTime as DateTime, timeZone as TimeZone
) as TimeSpan

Parameters

Return value

TimeSpan — A time span representing the time zone's offset from UTC.

Example

Code
dim tz = TimeZoneFromName("America/New_York")
dim dt = DateTimeFromParts(2021, 3, 13, 0, 0, 0, 0)
dim offset = UtcOffset(dt, tz)
print TotalHours(offset)
Output
-5