DATESUB

From AgileApps Support Wiki

The DATESUB function does one of two things:

  • Subtracts a number from a date, datetime, or time variable, and returns a date
  • Subtracts a date, datetime, or time variable from another date, datetime, or time variable, and returns a number
Syntax
 DATESUB('dString', 'dString' or number [,'DAY' or 'MONTH' or 'YEAR' or 'HOUR' or 'MINUTE'])
Return
A date in the format defined by Date Format
An integer representing the number of days
Example
DATESUB('12/06/2010', 2, 'MONTH') = '10/06/2010'
DATESUB('12/06/2010', 2, 'YEAR') = '12/06/2008'
DATESUB('12/06/2010', 2, 'DAY') = '12/04/2010'
DATESUB('12/26/2010', '12/06/2010') = 20


See Date Format for more detail on the parameters used in this function.