SetTimeZone
- Last UpdatedOct 29, 2026
- 2 minute read
This function sets the time zone for the Viewer module / thin client, separate from the local computer's system settings.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
SetTimeZone |
Date and Time |
Synchronous |
No |
Supported |
Supported (see Notes below) |
Not supported |
Supported |
Not supported |
Syntax
SetTimeZone( optTimeZone )
SetTimeZone ( { | optTimeZone } )
optTimeZone
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. |
|
0 |
The current time zone in the Viewer module / thin client. |
|
1 |
Coordinated Universal Time (UTC). |
|
2 |
The current time zone in the local computer's system settings. |
|
"timezone" |
The full name of a time zone. |
This parameter is optional; if no value is specified, the default value is 2.
Returned value
This function returns one of the following possible values:
|
Value |
Description |
|---|---|
|
-3 |
Invalid time zone name or index. |
|
-2 |
Invalid number of parameters. |
|
-1 |
Invalid function call; this function can only be called from the Viewer module / thin client. The project runtime will always use the local computer's system settings. |
|
0 |
Function executed successfully. |
Notes
The list of available time zones varies by operating system version and configuration. If necessary, you can use the functions GetTimeZoneCount and GetTimeZone to generate a list that is specific to your computer.
Examples
Reset the time zone to the local computer's system settings:
SetTimeZone()
Set the time zone to UTC:
SetTimeZone(1)
Set the time zone to index 24:
SetTimeZone(-24)
Set the time zone to Central Standard Time:
SetTimeZone("Central Standard Time")