DATESUB        Subtract specified number of days from a date variable

Top  Previous  Next

Syntax:

DATESUB

[ 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 subtract from the date contained in [ variable ].

Options:

none

 

 

 

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

 

Consider the example below where 14 days is subtract from a variable containing the current date.

 

SET today = %date

DATESUB today 14

 

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

 

SET today = %date

SETNUM SETdays = 14

DATESUB today days

 

The %date internal variable may not be used in this command directly.

 

Related Command(s): DATEADD

See also: Using the %date, %datetime, and %time Variables