StrFromTime
- Last UpdatedOct 29, 2026
- 2 minute read
Converts a timestamp from UTC standard notation into a formatted string, adjusted to reflect the Time Zone setting in the Control Panel of the local computer.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
StrFromTime |
String |
Synchronous |
Yes |
Supported |
Supported |
Supported |
Supported |
Supported |
Syntax
StrFromTime( numUTCTime, numType )
numUTCTime
An integer, or a tag of Integer type. A timestamp given in UTC standard notation.
numType
An integer, or a tag of Integer type. Specifies the format of the resulting string, as described in the following table:
|
Value of numType |
Description |
|---|---|
|
1 |
Displays the date in the same format that is selected in the Control Panel on the local computer. |
|
2 |
Displays the time in the same format that is selected in the Control Panel on the local computer. |
|
3 |
Displays a standard 24-character string that shows both date and time. |
|
4 |
Displays the abbreviated name of the day of the week. |
|
5 |
Displays the full name of the day of the week. |
Returned value
This function returns a string representation of the given timestamp, with the specified formatting. The returned value can be stored in any tag of String type.
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.
Notes
The Coordinated Universal Time (UTC) standard counts the number of seconds elapsed since 12:00 AM GMT on January 1, 1970. Each day consists of 86,400 seconds.
Examples
Note: The examples below are for a computer set to Eastern Standard Time (or UTC -05:00).
|
Tag Name |
Expression |
|---|---|
|
Tag |
StrFromTime( 86400, 1 ) // Returned value = "1/1/70" |
|
Tag |
StrFromTime( 86400, 2 ) // Returned value = "07:00:00 PM" |
|
Tag |
StrFromTime( 86400, 3 ) // Returned value = "Thu Jan 01 19:00:00 1970" |
|
Tag |
StrFromTime( 86400, 4 ) // Returned value = "Thu" |
|
Tag |
StrFromTime( 86400, 5 ) // Returned value = "Thursday" |