DAYS returns a FIXED BINARY(31,0) value that is the number of days (in Lilian format) corresponding to the date d.
>>-DAYS--+--------------------------+-------------------------->< '-(-+------------------+-)-' '-d--+-----------+-' '-,p-+----+-' '-,w-'
The value for d must have computational type and should have character type. If not, d is converted to character.
p must have computational type and should have character type. If not, it is converted to character.
dcl Date_format value ('MMDDYYYY') char;
dcl Todays_date char(length(Date_format));
dcl Sep2_1993 char(length(Date_format));
dcl Days_of_July4_1993 fixed bin(31);
dcl Msg char(100) varying;
dcl Date_due char(length(Date_format));
Todays_date = datetime(date_format); /* e.g. 06161993 */
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);
The allowed patterns are listed in Table 2. For an explanation of the Lilian format, see Date/time built-in functions.