The LAST_DAY function returns the last day of the given month as DATE type.
If every argument value of date and time is 0, the return value is determined by the return_null_on_function_errors system parameter; if it is set to yes, then NULL is returned; if it is set to no, an error is returned. The default value is no.
LAST_DAY ( date_argument )
date_argument :
• date
• NULL
--it returns last day of the momth in DATE type
SELECT LAST_DAY(DATE '1980-02-01'), LAST_DAY(DATE '2010-02-01');
last_day(date '1980-02-01') last_day(date '2010-02-01')
============================================================
02/28/1980 02/28/2010
--it returns last day of the momth when explicitly casted to DATE type
SELECT LAST_DAY(CAST (SYS_TIMESTAMP AS DATE)), LAST_DAY(CAST (SYS_DATETIME AS DATE));
last_day( cast( SYS_TIMESTAMP as date)) last_day( cast( SYS_DATETIME as date))
================================================================================
02/28/2010 02/28/2010
SELECT LAST_DAY('0000-00-00');
ERROR: Conversion error in date format.