UTC2DateTime

This function converts a date and time from Coordinated Universal Time (UTC) to the specified time zone.

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

Syntax

  UTC2DateTime( strUTC, optTimeZone )  
Web Studio Help tions datetime utc2timedate.xml d403002e117 UTC2DateTime

strUTC
The date and time to be converted, in the format "MM/DD/YYYY HH:MM:SS".
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.

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.

This may be different from the current time zone in the local computer’s system settings, if the function SetTimeZone was executed previously.

1 Coordinated Universal Time (UTC).
2 The current time zone in the local computer’s system settings.

On Windows Embedded Compact, this value is invalid.

"timezone" The full name of a time zone (e.g., "Central Standard Time").

On Windows Embedded Compact, this value is invalid.

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

Returned value

If this function is executed successfully, it returns a string that contains the specified date and time converted from UTC to the specified time zone. Otheriwse, it returns one of the following possible values:
Value Description
-5 Invalid time zone name or index.
-4 Invalid or improperly formatted date/time.
-3 The specified value is not a string.
-2 Invalid number of parameters.

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.

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

Examples

Convert the specified date/time from UTC to the current time zone:
  UTC2DateTime("07/15/2013 19:54:46")  
Convert the specified date and time from UTC to Central Standard Time:
  UTC2DateTime("07/15/2013 19:54:46","Central Standard Time")  
Convert the current date and time from UTC to Central Standard Time:
  UTC2DateTime(GetUTC(),"Central Standard Time")  

UTC2DateTime