SYS_TIME

Use the SYS_TIME script function to retrieve the current time. The script function returns the time at the beginning of script processing, and freezes that time for the rest of the processing.

Tip: Use SYS_TIME_PHYSICAL to retrieve the current time at the actual time of processing.

Syntax

SYS_TIME ([Time format][,Time Zone|UTC])

Parameters

Notes:

Important! When you use a :PUT_VAR script statement to transfer the current time to a VARA object that has the data type timestamp, the time can only be saved together with a date. Use one of the following combinations of date and time formats:

Note: (Windows only) The format is not saved when the variable is stored on the Windows platform. The displayed date format is determined by the regional options defined in the control panel of Windows.

Examples

The following example determines the current time of day and stores the value in a script variable. The script uses a Time Zone object that is defined for Central European Time. The script prints the retrieved time in the activation report of the task.

:SET &TIME# = SYS_TIME("HH:MM:SS","TZ.CET")
:
PRINT &TIME#

The following example specifies a time format that retrieves the seconds of the current time.

:SET &FORMAT# = "SS"
:
SET &TIME# = SYS_TIME(&FORMAT#)

The following example does not specify a time format. The script uses the current time in the default HHMMSS format to define a condition.

:IF SYS_TIME() = "120000" 
!...

:
ENDIF

The following example retrieves the current date and time, and uses the values to store an entry in a VARA object of timestamp data type. The script uses the default date and time formats.

:SET &DATE# = SYS_DATE()
:
SET &TIME# = SYS_TIME()
:
PUT_VAR ENTRY DATE, , "&DATE# &TIME#"

See also:

seealso

Script Elements for System Conditions and Settings