The DAYOFWEEK function returns an integer between 1 and 7 that represents the day of the week, where 1 is Sunday and 7 is Saturday. For another alternative, see DAYOFWEEK_ISO.
If expression is a character or graphic string, it must not be a CLOB or DBCLOB and its value must be a valid string representation of a date or timestamp. For the valid formats of string representations of dates and timestamps, see String representations of datetime values.
The result of the function is a large integer. If the argument can be null, the result can be null; if the argument is null, the result is the null value.
SELECT DAYOFWEEK(HIREDATE) INTO :DAY_OF_WEEK FROM EMPLOYEE WHERE EMPNO = '000010'Results in DAY_OF_WEEK being set to 6, which represents Friday.
SELECT DAYOFWEEK(CAST('10/11/1998' AS DATE)), DAYOFWEEK(TIMESTAMP('10/12/1998','01.02')), DAYOFWEEK(CAST(CAST('10/11/1998' AS DATE)) AS CHAR(20))), DAYOFWEEK(CAST(TIMESTAMP('10/12/1998','01.02') AS CHAR(20))), FROM SYSIBM.SYSDUMMY1
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.