LAST_DAY SYNTAX: LAST_DAY(d) PURPOSE: Returns the date of the last day of the month that contains d. You
might use this function to determine how many days are left in the
current month. EXAMPLES: SELECT SYSDATE, LAST_DAY(SYSDATE) "Last",
LAST_DAY(SYSDATE) - SYSDATE "Days Left"
FROM DUAL SYSDATE Last Days Left --------- --------- ---------
18-NOV-92 30-NOV-92 12 SELECT TO_CHAR(ADD_MONTHS(LAST_DAY(hiredate),5),
'DD-MON-YYYY') "Five months"
FROM emp
WHERE ename = 'MARTIN' Five months
-----------
28-FEB-1992
might use this function to determine how many days are left in the
current month. EXAMPLES: SELECT SYSDATE, LAST_DAY(SYSDATE) "Last",
LAST_DAY(SYSDATE) - SYSDATE "Days Left"
FROM DUAL SYSDATE Last Days Left --------- --------- ---------
18-NOV-92 30-NOV-92 12 SELECT TO_CHAR(ADD_MONTHS(LAST_DAY(hiredate),5),
'DD-MON-YYYY') "Five months"
FROM emp
WHERE ename = 'MARTIN' Five months
-----------
28-FEB-1992
select last_day(sysdate-60)+1 from dual;
----------
01-5月 -03
------------------------------
2003-5-1