Friday, January 11, 2013

Last_Day Function


In Oracle/PLSQL, the last_day function returns the last day of the month based on a date value.

Syntax

The syntax for the last_day function is:
last_day( date )
date is the date value to use to calculate the last day of the month.

Applies To

  • Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

For Example

last_day(to_date('2003/03/15', 'yyyy/mm/dd'))would return Mar 31, 2003
last_day(to_date('2003/02/03', 'yyyy/mm/dd'))would return Feb 28, 2003
last_day(to_date('2004/02/03', 'yyyy/mm/dd'))would return Feb 29, 2004