Tuesday, 31 October 2017

LAST_DAY Function

  • LAST_DAY function returns the last date of the specified month. 
  • LAST_DATE function returns date.
  • Mostly used to determine how many days are left in the current month.
Syntax:  LAST_DAY(datetime_expression)

To find the number of days we need to use LAST_DAY function

SELECT LAST_DAY(SYSDATE) -SYSDATE FROM dual;


Or we can use the EXTRACT and LAST_DAY  function to find the number of days left in this month

SELECT EXTRACT(DAY FROM LAST_DAY(SYSDATE)) FROM dual;


No comments:

Post a Comment