TMBASIC
Documentation
Docs
GitHub
TMBASIC Documentation
►
Procedures: Dates and Times
TimeZoneFromName
Procedure
Looks up a
TimeZone
by name.
Declaration
function TimeZoneFromName(name as String) as TimeZone
Parameters
name
as
String
— An acronym like
UTC
and
EST
, a location like
America/Chicago
, or a generic GMT offset like
Etc/GMT+4
.
Return value
TimeZone
— A time span representing the time zone's offset from UTC.
Possible error codes
ERR_INVALID_TIMEZONE
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