ClockGetTime

This function calculates the time that corresponds to a specified number of seconds that have elapsed since 12:00 AM GMT on January 1, 1970.

Function Group Execution Windows Embedded Thin Client Mobile Access
ClockGetTime Date & Time Synchronous Supported Supported Supported Supported

Syntax

  ClockGetTime( numSeconds, optTimeZone )  
Web Studio Help ction datetime clockgettime.xml d89955e85 ClockGetTime
numSeconds
A number of seconds that have elapsed since 12:00 AM GMT on January 1, 1970. This number is typically provided by the function GetClock, but it can be any number.
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 time that corresponds to the specified number of seconds. If a time zone is specified, the time is adjusted to reflect the change from the current time zone to the specified time zone. The time is formatted as HH:MM:SS.

If this function is not executed successfully — for example, if the specified time zone is invalid — it returns a value of 0.

Notes

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

Examples

Get the time when the system clock started counting (i.e., 00:00:00):
  ClockGetTime(0,"Greenwich Mean Time")  
Get a returned value of 10:59:19:
  ClockGetTime(1018886359)  
Get the current number of seconds elapsed since 12:00 AM GMT on January 1, 1970, then format that as a time, then adjust it from the current time zone to Central Standard Time:
  ClockGetTime(GetClock(),"Central Standard Time")  

ClockGetTime