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?



Follow us on Facebook and Twitter for latest update.