GetTimeZone
Returns the index value of a time zone that is defined in the server registry.
Syntax
GetTimeZone([Val])
Parameters
Val
Type: None
Optional. Long or Text value that specifies which time zone to use.
(return)
Type: Long
Index of the local time zone.
Remarks
If Val is a Long value, it is the index value of a time zone that is defined in the server registry.
If Val is a Text value, it is the name of a time zone that is defined in the server registry.
If
Val is omitted, NULL or empty, the time zone that is associated with the program in which the function is called is used. By default, the program's time zone is the local time zone of the server, but the value can be changed by calling
SetTimeZone.
If a time zone name is used, it is case-insensitive.
The special values of -1 and "UTC" can be used for the time zone. The values do not correspond to anything in the registry, but instead refer to UTC time, with no offset or daylight savings value defined.
If Val is any other type, an error occurs.
If the time zone specified by Val cannot be found in the registry, an error occurs. The function can be used to determine whether a specific value represents a valid time zone.
GetTimeZone() returns -1 when a server's base language is different from the installed language pack. The time zone names in the Windows registry are based on the operating system's base language. As such, the current time zone name is read from the operating system based on the base language. -1 is returned because it is not possible to locate the correct time zone in the Windows registry.
Example
This example returns the index value of the Central Standard Time time zone from the registry.
GetTimeZone("Central Standard Time")
See also