SYS_DATE
Script Function: Returns the current date at the beginning of the script processing
Syntax
SYS_DATE ([Date Format][,TimeZone])
Syntax |
Description/Format |
---|---|
Date Format |
Format for the retrieved date. |
TimeZone |
Name of a TimeZone object or the keyword UTC. |
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.
Date Format is optional. It is used to determine the format in which the function should return values. If you do not specify Date Format, the default format "YYMMDD" 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 directly in UTC (Coordinated Universal Time).
The current date is determined at the beginning of the script processing
and "frozen". This ensures the consistency of the script. If
you use the script function repeatedly within a script, the same date
will always be returned. This is especially important when the script
processing for a specified time period is interrupted by a :WAIT
statement.
In order to transfer the current date with the script statement :PUT_VAR
to a Variable object of the type "Time stamp", you must use
the date formats "YYMMDD" (Default), "YYYYMMDD"
or "YYYY-MM-DD". This format is not saved after saving to the
variable on the Windows platform. The display of the date is based now
on the regional options in the control panel of Windows.
Examples
In the first example, the current date is retrieved and stored in a script variable. The second example shows that it is also possible to use special terms. The day of the week is retrieved while using a script variable as a function parameter.
:SET &DATE# = SYS_DATE("DD.MM.YYYY")
:SET &FORMAT# = "WW"
:SET &WEEKDAY# = SYS_DATE(&FORMAT#)
This example shows how this function is used without specification of Date Format.
:IF SYS_DATE()
= "990101"
!...
:ENDIF
In the third example, the current date is determined and saved in a Variable object of the type "Time stamp". A TimeZone is used which has been defined for Central European Time.
:SET &DATE# = SYS_DATE("YYYY-MM-DD","TZ.MEZ")
:PUT_VAR BOOKING.DATE,
, &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_DATE_PHYSICAL | Returns the current date. |
SYS_LDATE | Returns the logical date. |
Script Elements - Date and Time
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function