AYMD: Adding or Subtracting Days

How to:

Available Operating Systems: z/OS, UNIX

The AYMD function adds days to or subtracts days from a date in year-month-day format. You can convert a date to this format using the CHGDAT or EDIT function.


Top of page

x
Syntax: How to Add or Subtract Days to or From a Date
AYMD(indate, days, output)

where:

indate

I6, I6YMD, I8, I8YYMD

Is the legacy date in year-month-day format. If the date is not valid, the function returns the value 0 (zero).

days

Integer

Is the number of days you are adding to or subtracting from indate. To subtract days, use a negative number.

output

I6, I6YMD, I8, or I8YYMD

Is the same format as indate.

If the addition or subtraction of days crosses forward or backward into another century, the century digits of the output year are adjusted.



Example: Adding Days to a Date

AYMD adds 35 days to each value in the HIRE_DATE field, and stores the result in a column with the format I6YMD.

AYMD(HIRE_DATE, 35, 'I6YMD')

For 99/08/01, the result is 99/09/05.

For 99/01/04, the result is 99/02/08.


iWay Software