DATETIMESUB        Subtract specified amount from the date time variable

Top  Previous  Next

Syntax:

DATETIMESUB

[ variable ] [ const ] [ /options ]

Arguments:

[ variable ]

A variable containing the formatted date and time string in the format of Sat Feb 17 11.00.22 2001.

 

[ const ]

A variable or a numeric constant representing the amount of time to subtract from the date and time string contained in [ variable ].

Options:

/day

Subtract specified number of days.

 

/hour

Subtract specified number of hours.

 

/minute

Subtract specified number of minutes.

 

/second

Subtract specified number of seconds.

 

 

This script command is used to subtract a specified amount of time from the formatted date and time string variable. The [ /options ] argument must be specified.

 

Consider the example below where 14 days is subtracted from a variable containing the current date and time.

 

SET today = %datetime

DATETIMESUB today 14 /day

 

Consider the example below where 34 minutes is subtracted from a variable containing the current date and time.

 

SET today = %datetime

DATETIMESUB today 34 /minute

 

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

 

SET today = %datetime

SETNUM SETdays = 14

DATETIMESUB today days /day

 

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

 

Related Command(s): DATETIMEADD, IFDATETIME

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