GetCanonicalTimeZoneID (open)

Get the canonical time zone name for a given time zone

Syntax

LOADLIB "wh::util/localization.whlib";

STRING FUNCTION GetCanonicalTimeZoneID(STRING timezone)

Parameters

STRING timezone

The time zone name to check

Return value

STRING

The canonical time zone name, or an empty string for a non-existing time zone

Description

Time zones are only returned by their canonical names by GetAvailableTimeZones and GetAvailableTimeZoneNames, so this function can be used to lookup a time zone by a time zone alias. It is not necessary to use this function for functions that take a time zone, like UTCToLocal, as they will automatically canonicalize the name.

Examples

// Returns "Asia/Katmandu"
STRING timezone := GetCanonicalTimeZoneID("Asia/Kathmandu");