DOWK and DOWKL: Finding the Day of the Week

How to:

Available Languages: reporting, Maintain

The DOWK and DOWKL functions find the day of the week that corresponds to a date. DOWK returns the day as a three letter abbreviation; DOWKL displays the full name of the day.

Syntax: How to Find the Day of the Week

{DOWK|DOWKL}(indate, output)

where:

indate

I6YMD or I8YYMD

Is the legacy date in year-month-day format. If the date is not valid, the function returns spaces. If the date specifies a two digit year and DEFCENT and YRTHRESH values have not been set, the function assumes the 20th century.

output

DOWK: A4. DOWKL: A12

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.

Example: Finding the Day of the Week

DOWK determines the day of the week that corresponds to the value in the HIRE_DATE field and stores the result in DATED:

TABLE FILE EMPLOYEE
PRINT EMP_ID AND HIRE_DATE AND COMPUTE
DATED/A4 = DOWK(HIRE_DATE, DATED);
WHERE DEPARTMENT EQ 'PRODUCTION';
END

The output is:

EMP_ID     HIRE_DATE  DATED
------     ---------  -----
071382660   80/06/02  MON
119265415   82/01/04  MON
119329144   82/08/01  SUN
123764317   82/01/04  MON
126724188   82/07/01  THU
451123478   82/02/02  TUE