Automation Engine Script Guide > Ordered by Function > Date and Time > SYS_DATE_PHYSICAL

SYS_DATE_PHYSICAL

Script Function: Returns the current date

Syntax

SYS_DATE_PHYSICAL([Date Format], [TimeZone])

Syntax

Description/Format

Date Format

Format for the determined date.
Format: script literal or script variable
Default value: "YYMMDD"

TimeZone

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


Return code

Current date in the specified format

Comments

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

If the script function is repeatedly used within a script, different results might be supplied (if there is a change of date between the first and the second call, for example). Thus, this script function differs  from SYS_DATE - which determines the date of the beginning of the script processing and keeps it,  in order to ensure the consistency of the script. 

Date Format is optional. It serves to define the format in which the value is returned. If you have not specified Date Format, the default format "YYMMDD" is returned.

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 time zone is entered, the default value (client's time zone) is used. Instead of a time zone, the keyword UTC may be used. The date is then returned in UTC (Coordinated Universal Time).

Examples

The first example determines the date and gives the value to a script variable. In the second example should show that the entry of partial terms is also possible. The weekday is determined and a script variable used as a function parameter.

:SET  &DATE# = SYS_DATE_PHYSICAL('DD.MM.YYYY')

:SET  &FORMAT# = 'WW'
:
SET  &WEEKDAY# = SYS_DATE_PHYSICAL(&FORMAT#)

If the function is used without the specification of Date Format, the syntax is as in the following example.

:IF  SYS_DATE_PHYSICAL() = '990101'  
!...
 
:
ENDIF

In the third example, the current day's date is determined. A TimeZone is used which has been defined for Central European Time. The result is written out in the activation protocol.

:SET  &DATE# = SYS_DATE_PHYSICAL('YYYY-MM-DD','TZ.MEZ')
:
PRINT  &DATE#

 

See also:

Script element Description

CONV_DATE

Converts a date from one date format to another.
DIFF_DATE Determines the difference between two date entries in days.
SYS_LDATE Returns the logical date.
SYS_DATE Returns the current date at the beginning of the script processing.

Script Elements - Date and Time

Date, Time and Period Formats

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function