w3resource

Oracle: Determine how many days are left in the current month

Oracle Datetime: Exercise-4 with Solution

Write a Oracle SQL statement to determine how many days are left in the current month.

Sample Solution:

Oracle Code:

SELECT SYSDATE,
       LAST_DAY(SYSDATE) "Last",
       LAST_DAY(SYSDATE) - SYSDATE "Days Left"
  FROM DUAL;

Output:

  	SYSDATE					Last					Days Left
1	2/24/2021 12:38:14 PM	2/28/2021 12:38:14 PM	4

Go to:


PREV : Write a Oracle SQL statement to get the current date in the specified session time zone.
NEXT : Write a Oracle SQL statement to get the first and last day of the current year.

Improve this sample solution and post your code through Disqus.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.