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

Improve this sample solution and post your code through Disqus.

Previous: 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.

What is the difficulty level of this exercise?



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/oracle-exercises/datetime/oracle-datetime-exercise-4.php