wwStringFromTime() Function
- Last UpdatedFeb 21, 2017
- 1 minute read
Converts a timestamp given in local time to UTC time and returns the result as a string. This function takes Daylight Saving Time into account.
Syntax
result = wwStringFromTime (timestamp, format)
Parameters
timestamp
The number of seconds that have passed since midnight of January 1, 1970 in the local time zone. A literal integer value, integer tagname, or integer expression.
format
Determines how the string result is shown. A literal integer value, integer tagname, or integer expression in the range from 1 to 5 with following meaning:
1 - Shows the date according to the format set in the Regional Settings of the local operating system
2 - Shows the time according to the format set in the Regional Settings of the local operating system
3 - Shows the date and time as a 24 character string (ddd mmm dd hh:mm:ss yyyy)
4 - Shows the day of the week in short form
5 - Shows the day of the week in long form
Example(s)
This example assumes that the time zone on the local node is Pacific Standard Time (PST, UTC-0800). The local time passed to the function is 04:00:00 PM on Thursday, January 1, 1970. Since PST is 8 hours behind UTC, the function returns the following results.
This script returns "1/2/70"
wwStringFromTime(57600,1)
This script returns "12:00:00 AM"
wwStringFromTime(57600,2)
This script returns "Fri Jan 02 00:00:00 1970"
wwStringFromTime(57600,3)
This script returns "Fri"
wwStringFromTime(57600,4)
This script returns "Friday"
wwStringFromTime(57600,5)