DAYS returns a FIXED BINARY(31,0) value which is the number of days (in Lilian format) corresponding to the date d.
The value for d should have character type. If not, d is converted to character.
p should have character type. If not, it is converted to character.
The following example shows uses of both the DAYS and DAYSTODATE built-in functions:
dcl date_format char(8) static init('MMDDYYYY');
dcl todays_date char(8);
dcl sep2_1993 char(8);
dcl days_of_july4_1993 fixed bin(31);
dcl msg char(100) varying;
dcl date_due char(8);
todays_date = daystodate(days(),date_format);
days_of_july4_1993 = days('07041993','MMDDYYYY');
sep2_1993 = daystodate(days_of_july4_1993 + 60, Date_format);
/* 09021993 */
date_due = daystodate(days() + 60, date_format);
/* assuming today is July 4, 1993, this would be Sept. 2, 1993
msg = 'Please pay amount due on or before ' ||
substr(date_due, 1, 2) || '/' ||
substr(date_due, 3,2) || '/' ||
substr(date_due, 5);