DateTime2UTC

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

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

Syntax

  DateTime2UTC( strDateTime, optTimeZone )  
Web Studio Help tions datetime datetime2utc.xml d399837e117 DateTime2UTC

strDateTime
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 the specified time zone to UTC. 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 and time from the current time zone to UTC:
  DateTime2UTC("07/15/2013 19:54:46")  
Convert the specified date and time from Central Standard Time to UTC:
  DateTime2UTC("07/15/2013 19:54:46","Central Standard Time")  

DateTime2UTC