Using the %date, %datetime, and %time Variables

Top  Previous  Next

 

These internal variables contain the current system date and time.

 

The value of %date is in the format mm-dd-yy (i.e., 02-16-01). This format allows you the option of using the value of %date in a file or directory name.  The more common date format mm/dd/yy (i.e. 02/16/01) is not used because the slash character is not allowed in a file or directory name.

 

The value of %datetime contains a formatted date and time string (i.e., Sat Feb 17 11.00.22 2001). Alternate variable %timedate is also accepted.

 

The value of %time, like the value of %time, is in the format hh.mm.ss (i.e., 11.00.22). This format allows you the option of using the value of %time in a file or directory name. The more common time format hh:mm:ss (i.e. 11:00:22) form is not used because the colon character is not allowed in a file or directory name.

 

Consider the following example where a unique folder is created within the Robo-FTP working folder.

 

MAKEDIR %datetime

 

Consider the following example where the current time is concatenated onto the end of the file name in order to make it unique. The resulting file name would be something like: c:\data\file.11.00.22.

 

SET rcvfile = "C:\data\file."

SET rcvfile &= %time

 

The IFDATE, IFDATETIME, and IFTIME script commands may be used for conditional branching based on date and/or time values.

 

Internal variables like %date, %datetime, and %timedate variables should not be modified directly but their values may be assigned to intermediate user defined variables which are then used for data arithmetic with script commands like DATEADD, DATESUB, DATETIMEADD, DATETIMESUB

 

 

See also: Internal Script Variables, Build File Name with Current Date