Purpose
LAST_DAY() returns the date of the last day of the month that contains the value of date.
Syntax
LAST_DAY(date)
Parameters
| Parameter | Description |
|---|---|
| date | A value of any data type that contains date information, such as DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, or TIMESTAMP WITH LOCAL TIME ZONE. |
Return type
The return type is DATE.
Examples
The following example returns the current date, the date of the last day of the current month, and the number of days left in the current month.
obclient> SELECT SYSDATE,LAST_DAY(SYSDATE) "Last",LAST_DAY(SYSDATE)-SYSDATE FROM DUAL;
+-----------+-----------+---------------------------+
| SYSDATE | Last | LAST_DAY(SYSDATE)-SYSDATE |
+-----------+-----------+---------------------------+
| 17-NOV-21 | 30-NOV-21 | 13 |
+-----------+-----------+---------------------------+
1 row in set