MONTHNAME
The MONTHNAME function returns the calendar name of the month in which a given date falls. The name is returned in English.
The schema is DSN8.
- input-date
- A valid date or valid character string representation of a date. A character string representation must have a data type of VARCHAR and an actual length that is no greater than 10 bytes. The date must be in ISO format.
The result of the function is VARCHAR(9).
The MONTHNAME function uses the IBM® C++ class IDate.
The following table shows the
external and specific names for MONTHNAME. The specific names differ
depending on the data type of the input argument.
Input arguments | External name | Specific name |
---|---|---|
input-date (VARCHAR)
|
DSN8EUMN | DSN8.DSN8EUMNV |
input-date (DATE)
|
DSN8EUMN | DSN8.DSN8EUMND |
Example 1: For the current date, find the name
of the month.
VALUES DSN8.MONTHNAME( CURRENT DATE );
Example
2: Find the month of the year in which Delores Quintana, employee
number 000130, was hired.
SELECT FIRSTNME || ' '
|| LASTNAME || ' was hired in the month of '
|| DSN8.MONTHNAME( HIREDATE )
|| CHAR( HIREDATE )
FROM EMP
WHERE EMPNO = '000130';
The result of the function
is 'DELORES QUINTANA was hired in the month of July
'.