DAYOFWEEK_ISO

The DAYOFWEEK_ISO function returns an integer, in the range of 1 to 7, that represents the day of the week, where 1 is Monday and 7 is Sunday. The DAYOFWEEK_ISO function is similar to the DAYOFWEEK function.

Read syntax diagram
>>-DAYOFWEEK_ISO(expression)-----------------------------------><

The schema is SYSIBM.

The argument must be an expression that returns a value of one of the following built-in data types: a date, a timestamp, a character string, or graphic string.

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 with an actual length that is not greater than 255 bytes. For the valid formats of string representations of dates and timestamps, see String representations of datetime values.

Start of changeIf expression is a timestamp with a time zone, or a valid string representation of a timestamp with a time zone, the result is determined from the UTC representation of the datetime value.End of change

The result of the function is a large integer.

The result can be null; if the argument is null, the result is the null value.

Example 1: Using sample table DSN8A10.EMP, set the integer host variable DAY_OF_WEEK to the day of the week that Christine Haas (EMPNO = '000010') was hired (HIREDATE).
   SELECT DAYOFWEEK_ISO(HIREDATE)
     INTO :DAY_OF_WEEK
     FROM DSN8A10.EMP
     WHERE EMPNO = '000010';
The result is that DAY_OF_WEEK is set to 5, which represents Friday.
Example 2: The following query returns four values: 7, 1, 7, and 1. Start of change
   SELECT DAYOFWEEK_ISO(CAST('10/11/1998' AS DATE)),
          DAYOFWEEK_ISO(TIMESTAMP('10/12/1998', '01.02')),
          DAYOFWEEK_ISO(CAST(CAST('10/11/1998' AS DATE) AS CHAR(20))),
          DAYOFWEEK_ISO(CAST(TIMESTAMP('10/12/1998', '01.02') AS CHAR(26)))
     FROM SYSIBM.SYSDUMMY1;
End of change
Example 3: The following list shows what is returned by the DAYOFWEEK_ISO function for various dates.
   DATE:           DAYOFWEEK_ISO returns:
   2003-12-28      '7'
   2003-12-31      '3'
   2004-01-01      '4'
   2004-01-10      '6'
   2005-01-04      '2'
   2005-12-31      '7'
   2006-01-01      '7'
   2006-01-03      '2'
Start of changeExample 4: The following invocations of the DAYOFWEEK_ISO function returns the same result:
SELECT DAYOFWEEK_ISO('2003-01-02-20.00.00'), 
			DAYOFWEEK_ISO('2003-01-02-12.00.00-08:00'), 
			DAYOFWEEK_ISO('2003-01-03-05.00.00+09:00') 
		FROM SYSIBM.SYSDUMMY1;
For each invocation of the DAYOFWEEK_ISO function in this SELECT statement, the result is 4 (Monday is considered the first day of the week).End of change

Start of changeWhen the input argument contains a time zone, the result is determined from the UTC representation of the input value. The string representations of a timestamp with a time zone in the SELECT statement all have the same UTC representation: 2003-01-02-20.00.00.End of change