Script Function: Returns the current date
SYS_DATE_PHYSICAL([Date Format], [TimeZone])
Syntax |
Description/Format |
---|---|
Date Format |
Format for the determined date. |
TimeZone |
Name of a TimeZone object or the keyword UTC. |
Return code |
---|
Current date in the specified format |
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).
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 |
---|---|
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
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function