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 objectAutomation Engine controlled activities and processes are structured in the form of objects. See also: Task or the keyword UTC. |
Return code |
---|
Current date in the specified format |
This script functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,… 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 clientA closed environment within an Automation Engine system where you can create and run objects. A client name consists of a 4-digit number that must be indicated when a user logs on to the Automation Engine system. Users and their rights are also defined in clients. A particular Automation Engine object type. if none has been defined for the object itself. If a non-defined time zoneIt defines a local time. A particular Automation Engine object type. 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 variableIt stores or retrieves values dynamically at runtime. An individual Automation Engine object type.. 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 dateThe logical date is used as a comparison date for checking Calendar conditions.. |
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
Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support |
Copyright © 2016 Automic Software GmbH |