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

Top  Previous  Next

 

These variables contain the current system date and time.

 

The %date variable contains the current system date in the form mm-dd-yy (i.e., 02-16-01). Note: the more common mm/dd/yy (i.e. 02/16/01) form is not used so that the %date variable may be used to name files.

 

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

 

The %time variable contains the current system time in the form hh.mm.ss (i.e., 11.00.22). Note: the more common hh:mm:ss (i.e. 11:00:22) form is not used so that the %time variable may be used to name files.

 

Consider the following example where a file name is created using the current time 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

 

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

 

MAKEDIR %datetime

 

The DATEADD and DATESUB script commands may be used to manipulate a date variable. Note: the %date variable cannot be modified directly.

 

The DATETIMEADD and DATETIMESUB script commands may be used to manipulate the formatted date and time string.

Note: the %datetime or %timedate variable cannot be modified directly.