DATEADD        Add specified number of days to a date variable

Top  Previous  Next

Syntax:

DATEADD

[ variable ] [ const ]

Arguments:

[ variable ]

A variable containing a date in the format of mm-dd-yy.

 

[ const ]

A variable or a numeric constant representing the number of days to add to the date contained in [ variable ].

Options:

none

 

 

 

This script command is used to add a specified number of days to a date variable.

 

Note: The %date internal variable should not be passed directly in the [ variable ] argument of this command.  To use the value of %date with DATEADD you must first assigned its value to to an intermediate user defined variable, and then pass that user defined variable as an argument.

 

Consider the example below where 14 days is added to a variable containing the current date.

 

SET today = %date

DATEADD today 14

DISPLAY today

 

The number of days to add may also be expressed in a variable as shown below.

 

SET today = %date

SETNUM days = 14

DATEADD today days

DISPLAY today

 

 

Related command(s): DATESUB, IFDATE, DATETIMEADD, DATETIMESUB, IFDATETIME

See also: Using the %date, %datetime, and %time Variables, Comparing Local and Remote Files, Comparing File Dates and Times