This Oracle tutorial explains how to use the Oracle/PLSQL LAST_DAY function with syntax and examples.
The Oracle/PLSQL LAST_DAY function returns the last day of the month based on a date value.
The syntax for the LAST_DAY function in Oracle/PLSQL is:
LAST_DAY( date )
The date value to use to calculate the last day of the month.
The LAST_DAY function returns a date value.
The LAST_DAY function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle LAST_DAY function examples and explore how to use the LAST_DAY function in Oracle/PLSQL.
For example:
LAST_DAY(TO_DATE('2003/03/15', 'yyyy/mm/dd'))
Output: Mar 31, 2003
LAST_DAY(TO_DATE('2003/02/03', 'yyyy/mm/dd'))
Output: Feb 28, 2003
LAST_DAY(TO_DATE('2004/02/03', 'yyyy/mm/dd'))
Output: Feb 29, 2004