SetTimeZone

This function sets the time zone for the Viewer module / thin client, separate from the local computer’s system settings.

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

Syntax

  SetTimeZone( optTimeZone )  
Web Studio Help ctions datetime settimezone.xml d402161e114 SetTimeZone
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 you do not specify a tag or value, then 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.

Also, this function is supported on Windows Embedded Standard but not on Windows Embedded Compact.

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")  

SetTimeZone