$DateChg
The $DATECHG function adds or subtracts a specified number of days from a given date. The result is returned in the format of the input date.
Syntax
The format of the $DATECHG function is:
$DATECHG(format, date, number of days)
where:
- format specifies the format of the input date. The format can be a combination of these elements:
DD | Gregorian numeric day |
DDD | Julian numeric date |
MM | Numeric month |
MON | Abbreviated month name |
MONTH | Full month name |
YY | Last two digits of numeric year (assumes that the year prefix is 19) |
YYYY | Full numeric year |
CYY | The century, plus the year. Century (C) is a single digit, where 0 represents 1900, 1 represents 2000, and so on. |
Valid formats are:
A format that has a month, day, and year element
A Julian date format that has a year element and a day element in the format DDD
Any EBCDIC characters except single quotes are allowed within the format. The format can be as many as 32 characters in length.
- date specifies a date in the format indicated by the format argument. The date can be as many as 36 characters in length.
- number of days indicates the number of days to be added or deducted from the date. The number must be an integer.
Separators and leading zeros
- The separators in the format argument must match the separators in the date argument. For example:
- When necessary, you must pad the month or date in the date argument with leading zeros to match the length of the format. For example:
$DATECHG('MONTH - DD - YYYY','JANUARY - 05 - 1986', 20)
$DATECHG('YY DDD','86 023',22)
How $DATECHG works
- If the number of days is a positive integer, the number is added to the date.
- If number of days is a negative integer, the number is deducted from the date.
- If an error occurs, all asterisks (*) are returned.
Example
PRINT $DATECHG('MON. DD, YYYY','JAN. 10, 1999', 15)
prints this value:
JAN. 25, 1999