DATETIMEADD Add specified amount to the date and time variable
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands > DATETIMEADD Add specified amount to the date and time variable |
Syntax: |
DATETIMEADD |
[ variable ] [ amount ] [ /unit ] |
Arguments: |
[ variable ] |
A variable that was previously assigned a string value formatted as a date and time in the style of Sat Feb 16 11.00.22 2013. |
|
[ amount ] |
A variable or a numeric constant representing the amount of time to add to the date and time value stored in [ variable ]. |
|
[ /unit ] |
The type of time units to add to the date and time value that is stored in [ variable ]. Possible values are: /day /hour /minute and /second. |
Options: |
none |
|
This script command is used to calculate a new date and time value by adding a specified amount of time to the date value stored in the [ variable ] argument. The date string value must be formatted in the same manner as the %datetime internal variable.
Note: The %datetime internal variable should not be passed directly in the [ variable ] argument of this command. To use the value of %datetime with DATETIMEADD you must first assign its value to a user defined variable and then pass that user defined variable to the [ variable ] argument.
Consider the example below where 14 days is added to a variable containing the current date and time.
DATETIMEADD today 14 /day
DISPLAY today
Consider the example below where 34 minutes is added to a variable containing the current date and time.
SET today = %datetime
DATETIMEADD today 34 /minute
DISPLAY today
The number of days to add may also be expressed in a variable as shown below.
SET today = %datetime
SETNUM x = 14
DATETIMEADD today x /day
DISPLAY today
Related command(s): DATETIMESUB, IFDATETIME, DATEADD, DATESUB, IFDATE, IFTIME
See also: Using the %date, %datetime, and %time Variables, Comparing Local and Remote Files, Comparing File Dates and Times