This function gets a specified time zone name or index.

Function Group Execution Windows Embedded Thin Client Mobile Access
GetTimeZone Date & Time Synchronous Supported Supported Supported Supported (see “Notes” below)


  GetTimeZone( optTimeZone )  
Web Studio Help ctions datetime gettimezone.xml d400738e114 GetTimeZone
A time zone name (string) or index (integer).
Value Description
-i A time zone index (i), up to the maximum index returned by the function GetTimeZoneCount.

On Windows Embedded Compact, the only valid index is -1 (i.e., the current time zone).

0 The current time zone in either the project runtime or the Viewer module / thin client, depending on where the function is called from.
"timezone" The full name of a time zone (e.g., "Central Standard Time").

On Windows Embedded Compact, the only valid name is the current time zone.

This parameter is optional; if you do not specify a tag or value, then the default value is 0.

Returned value

If optTimeZone is a time zone name, this function returns the corresponding index. If optTimeZone is a time zone index, this function returns the corresponding name. Otherwise, this function returns one of the following possible values:
Value Description
2 Invalid number of parameters.
3 Invalid time zone name or index.
4 Windows Embedded Compact only supports the current time zone.


The list of available time zones varies by operating system version and configuration. If necessary, you can use this function in combination with the function GetTimeZoneCount to generate a list that is specific to your computer.

If this function is called on Mobile Access, it is executed using the system time on the project runtime server.


Get the current time zone:
Get the time zone name that corresponds to time zone index 24:
Get the time zone index that corresponds to Central Standard Time:
  GetTimeZone("Central Standard Time")