SYS_TIME

Script Function: Returns the current time of day at the beginning of the script processing.

Syntax

SYS_TIME ([Time Format][,TimeZone])

Syntax

Description/Format

Time Format

Format for the retrieved time.
Format: script literal or script variable
Default: "HHMMSS"

TimeZone

Name of a TimeZone object or keyword UTC.
Format: script literal or script variable


Return code

Current time in the specified format

Comments

This script function determines the current day's date. A TimeZone, entered as a parameter, is included.

Time Format is optional. It is used to determine the format in which the function should return values. If you do not specify a Time Format, the default format "HHMMSS" is used.

TimeZone is also optional. If the script function is called without this parameter, the object's TimeZone is used, or that of the client if none has been defined for the object itself. If a non-defined TimeZone is entered, the default value (client's TimeZone) is used. Instead of a TimeZone, the keyword UTC may be used. The date is returned in UTC (Coordinated Universal Time).

The current time is determined at the beginning of the script processing and kept. This ensures the consistency of the script. If you use the script function repeatedly within a script, the same time will always be returned. This is especially important when the script processing for a specified time period is interrupted with a :WAIT statement.

In order to transfer the current date to a Variable object of the type "Time Stamp" with the script statement :PUT_VAR, the date formats "YYMMDD" (Default), "YYYYMMDD" or "YYYY-MM-DD" must be used. This format is not stored when the variable is stored on the Windows platform. The display of the date is now based on the regional options in the control panel of Windows.

The time can only be saved together with the date in a variable of the type "Time stamp". Only the following combinations of date and time format are allowed: "YYMMDD HHMMSS" (Default), "YYYY-MM-DD" and "YYYYMMDD HHMMSS".

Examples

The first example determines the current time of day and gives the value to a script variable. A TimeZone is used which has been defined for Central European Time. The result is written out in the activation protocol.

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

In the second example, a special term is used and transferred with a script variable. Only the seconds of the current time of day are determined.

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

If the function is used without the specification of Time Format and TimeZone, the Syntax is as in the following example.

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

:
ENDIF

 

In the third example, the current date and time are determined and saved in a Variable object of the type "Time Stamp". For date and time format, the following default values apply.

 

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

See also:

Script element Description
SYS_TIME_PHYSICAL Determines the current time of day.
SYS_TIMESTAMP_PHYSICAL Provides current date and time.

Script Elements - Date and Time

Date and Time Formats

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function