LAST_DAY function returns date (not just day) where the day is set to the last day of the month.
Quick Example:
Get the last date of the current month (SYSDATE returns January 11, 2012 in this example):
SELECT LAST_DAY(SYSDATE) FROM dual; -- Result: January 31, 2012
Summary information:
Syntax | LAST_DAY(datetime_expression) |
Return Type | DATE |
Last Update: Oracle 11g Release 2
LAST_DAY function returns the last date of the specified month in the input datetime expression:
-- Set default datetime format in string literals ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MM-YYYY'; -- Get last date in January 2012 SELECT LAST_DAY('11-01-2012') FROM dual; -- Result: 31-01-2012
LAST_DATE function returns date, and you can use EXTRACT function to get day:
SELECT EXTRACT(DAY FROM LAST_DAY('11-01-2012')) FROM dual; -- Result: 31