Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

UTC2DateTime

  • Last UpdatedOct 29, 2026
  • 2 minute read

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

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

UTC2DateTime

Date and Time

Synchronous

Yes

Supported

Supported

Not supported

Supported

Executed on Server

Syntax

UTC2DateTime( strUTC, optTimeZone )

UTC2DateTime ( strUTC { | ,optTimeZone } )

strUTC

The date and time to be converted. The date must be formatted according to the current date format; for more information, see About the date format and how to change it. The time must be formatted as 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.

0

The current time zone in either the project runtime server or the project thin client, depending on where the function is called.

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

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 (for example, "Central Standard Time").

This parameter is optional; if no value is specified, 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. Otherwise, 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 in a project screen on Mobile Access, it is executed using the system clock and date/time settings on the computer that hosts 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")

In This Topic