LAST_DAY

The LAST_DAY function returns the date of the last day of the month that contains the input date.

Syntax

LAST_DAY ( dateExpression )

dateExpression

A date value.

Results

The return type is always  DATE, regardless of the data type of the dateExpression.

Examples

Examples:
splice> values (LAST_DAY(CURRENT_DATE));
1
----------
2015-11-30

splice> values (LAST_DAY(DATE(CURRENT_TIMESTAMP)));
1
----------
2015-11-30

splice> SELECT DISPLAYNAME, BirthDate, LAST_DAY(BirthDate) "MonthEnd"
   FROM Players
   WHERE MONTH(BirthDate) IN (2, 5, 12);
DISPLAYNAME             |BIRTHDATE |MonthEnd
----------------------------------------------
Tam Croonster           |1980-12-19|1980-12-31
Jack Peepers            |1981-05-31|1981-05-31
Jason Martell           |1982-02-01|1982-02-28
Kameron Fannais         |1982-05-24|1982-05-31
Jonathan Pearlman       |1982-05-28|1982-05-31
Greg Brown              |1983-12-24|1983-12-31
Edward Erdman           |1985-12-21|1985-12-31
Jonathan Wilson         |1986-05-14|1986-05-31
Reed Lister             |1986-12-16|1986-12-31
Larry Lintos            |1987-05-12|1987-05-31
Taylor Trantula         |1987-12-17|1987-12-31
Tim Lentleson           |1988-02-21|1988-02-29
Cameron Silliman        |1988-12-21|1988-12-31
Nathan Nickels          |1989-05-04|1989-05-31
Tom Rather              |1990-05-29|1990-05-31
Mo Grandosi             |1992-02-16|1992-02-29

16 rows selected

See Also