BEFORE |
Scroll |
The BEFORE function returns the value of a date, time or timestamp resulting from subtracting a specified number of days, months, years, minutes, hours and/or seconds or years from a source date.
Category
Date / Time
Syntax
BEFORE(<date> | <time> | <timestamp>, ['nYY], [nMM], [nDD], [nHH], [nMI], [nSS]' )
Parameter Descriptions
date - This parameter specifies a source date in YYYYMMDD format.
time - This parameter specifies a source time in HHMMSS format or the source timestamp in YYYYMMDDHHMMSS format.
timestamp - This parameter specifies a timestamp in YYYYMMDDHHMMSS format.
['nYY]' - Specifies the number of years, n, to be subtracted from the date/time value.
['nMM]' - Specifies the number of months, n, to be subtracted from the date/time value.
['nDD]' - Specifies the number of days, n, to be subtracted from the date/time value.
['nHH]' - Specifies the number of hours, n, to be subtracted from the date/time value.
['nMI]' - Specifies the number of minutes, n, to be subtracted from the date/time value.
['nSS]' - Specifies the number of seconds, n, to be subtracted from the date/time value.
Example
Subtract 5 years, 3 months and 2 days from the date 03/01/2006, which is in field SRC_DATE, and map it to target field TGT_DATE.
TGT_DATE = BEFORE (SRC_DATE, '5YY', '3MM', '2DD')
The result is a date value of 11/27/2001 in field TGT_DATE.