The LAST_DAY function returns the date of the last day of the month that contains date.
Syntax
LAST_DAY (date)
Parameters
| Parameter | Description |
|---|---|
| date | A value of a data type that contains the date information, such as DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIMESTAMP WITH LOCAL TIME ZONE. |
Return type
DATE data type
Examples
In this example, the following information is queried: the current date, the last day of the current month, and the number of the remaining days in the current month.
Execute the following statement:
SELECT SYSDATE, LAST_DAY(SYSDATE)Last, LAST_DAY(SYSDATE)-SYSDATE "Left" FROM DUAL;
The following query result is returned:
+---------------------+---------------------+------+
| SYSDATE | LAST | Left |
+---------------------+---------------------+------+
| 2020-03-08 15:23:33 | 2020-03-31 15:23:33 | 23 |
+---------------------+---------------------+------+