SYS_TIME_PHYSICAL

Use the SYS_TIME_PHYSICAL script function to retrieve the current time at the time of processing. The script function lets you specify a date format and optional time zone.

Tip: When your script calls this function multiple times and the time changes between the calls, the retrieved times will differ. If you need the time to remain the same throughout the script, use SYS_TIME.

Syntax

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

Parameters

  • SYS_TIME_PHYSICAL
    Returns the current time

  • Time format
    (Optional) Time format for the retrieved date
    For more information, see Date, Time and Period Formats in Scripts.
    Format: script literal or script variable
    Default: HHMMSS

  • Time Zone or UTC
    (Optional) Specifies the time zone for the date
    Format: script literal or script variable
    Allowed values:

    • Name of a Time Zone object
      For more information, see Time Zone (TZ).
      Format: script literal or script variable
    • UTC
      Returns the time in UTC (Coordinated Universal Time)

Notes:

  • The Time Zone defined in the object attributes applies, unless you specify a different Time Zone.
  • If the object has no defined Time Zone, or if you specify a non-defined Time Zone object, then the Time Zone defined for the Client applies.

Examples

The following script retrieves the current time twice, with an interval of 10 seconds between the two calls. The times are stored in script variables, in HH:MM:SS format.

:SET &TIME1# = SYS_TIME_PHYSICAL("HH:MM:SS")
:
WAIT 10
:
SET &TIME2# = SYS_TIME_PHYSICAL("HH:MM:SS")

The following script determines the current time of day in UTC. After a 10 second wait, the script uses a Time Zone object to determine the current time in the Central European time zone. The retrieved times should differ by 1 hour and 10 seconds.

:SET &TIME1# = SYS_TIME_PHYSICAL("HH:MM:SS","UTC")
:
WAIT 10
:
SET &TIME2# = SYS_TIME_PHYSICAL("HH:MM:SS","TZ.MEZ")

The following example specifies a time format to retrieve the minutes of the current time.

:SET &FORMAT# = "MM"
:
SET &TIME# = SYS_TIME_PHYSICAL(&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_PHYSICAL() = "120000"  
!...

:
ENDIF

See also: