DB2 Version 9.7 for Linux, UNIX, and Windows

DAYNAME scalar function

Read syntax diagramSkip visual syntax diagram
>>-DAYNAME--(--expression--+----------------+--)---------------><
                           '-,--locale-name-'      

The schema is SYSIBM. The SYSFUN version of the DAYNAME function continues to be available

The DAYNAME function returns a character string containing the name of the day (for example, Friday) for the day portion of expression, based on locale-name or the value of the special register CURRENT LOCALE LC_TIME.

expression
An expression that returns a value of one of the following built-in data types: a DATE, TIMESTAMP, or a valid character string representation of a date or timestamp that is not a CLOB. In a Unicode database, if a supplied argument is a graphic string, it is first converted to a character string before the function is executed.
locale-name
A character constant that specifies the locale used to determine the language of the result. The value of locale-name is not case-sensitive and must be a valid locale (SQLSTATE 42815). For information on valid locales and their naming, see "Locale names for SQL and XQuery". If locale-name is not specified, the value of the special register CURRENT LOCALE LC_TIME is used.

The result is a varying-length character string. The length attribute is 100. If the resulting string exceeds the length attribute of the result, the result will be truncated. If the expression argument can be null, the result can be null; if the expression argument is null, the result is the null value. The code page of the result is the code page of the section.

Notes

Example

  • Assume that the variable TMSTAMP is defined as TIMESTAMP and has the following value: 2007-03-09-14.07.38.123456. The following examples show several invocations of the function and the resulting string values. The result type in each case is VARCHAR(100).
    Function invocation                              Result
    --------------------------                      ----------
    DAYNAME (TMSTAMP, 'CLDR 1.5:en_US')              Friday
    DAYNAME (TSMTAMP, 'CLDR 1.5:de_DE')              Freitag
    DAYNAME (TMSTAMP, 'CLDR 1.5:fr_FR')              vendredi