Assign Date Functions

Reference:        Assign

Open Syntax Window

 

The Assign command supports two special date functions.  FileDate is used to determine the last modified date of an existing file.  Date is used to assign and modify specific date-time values.  Both functions result in numeric values.  Date-time values can be used to schedule scripts using the Queue_Script command and as part of the %T wildcard to set the current time for the other date and time wildcard values.

A FileDate assignment is followed by a file name.  Like the Present command, the file name is assumed to follow the FileDate command and does not require quotes.  The file name may include variables, server names, and other wildcards.  It may also include wildcard characters, but the date-time value will be for the first file that is retrieved.

            :Assign: ModDate = FileDate {ftp:server}/Input/Test.txt

            :Assign: LocMod = FileDate %’LocPath’\%’ThisFile’

A Date assignment begins with a starting time followed by specific settings for some portion of the value.  These can be either offsets to the current value, or replacements of the current value.  Offsets are indicated by plus and minus characters.  Replacements are indicated by the @ character.  The function supports the following keywords:

TimeNow

The current time and date

EOM

Last day of the month

Years

Date and time values

Months

 

Days

 

Hours

 

Minutes

 

Seconds

 


The date and time values may be abbreviated.  The function operates by taking a starting time and processing a string of offsets and/or replacements.  For example, the last day of the current month can be specified as follows:

            :Assign: Endmonth = Date TimeNow + EOM

The last minute of the current month can be set as follows

            :Assign: Endmonth = Date TimeNow + EOM @ 23 H @ 59 Min

The last minute of next month:

            :Assign: Endmonth = Date TimeNow + 1 Mo + EOM @ 23 H @ 59 Min

Date can also start with a variable value such as the predefined starting time or scheduled time for the script, %’ScriptStart’ and %’ScriptSchedule’.