w3resource

Oracle: Number of days in current month

Oracle Datetime: Exercise-6 with Solution

Write a Oracle SQL statement to get the number of days in current month.

Sample Solution:

Oracle Code:

SELECT CAST (TO_CHAR (LAST_DAY (SYSDATE), 'dd') AS INT) number_of_days FROM DUAL; 

Output:

  	NUMBER_OF_DAYS
1	28

Improve this sample solution and post your code through Disqus.

Previous: Write a Oracle SQL statement to get the first and last day of the current year.
Next: Write a Oracle SQL statement to get number of days between two given dates.

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://www.w3resource.com/oracle-exercises/datetime/oracle-datetime-exercise-6.php