Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

Oracle: Number of days between two given dates

Oracle Datetime: Exercise-7 with Solution

Write a Oracle SQL statement to get number of days between two given dates.

Sample Solution:

Oracle Code:

SELECT ROUND ((MONTHS_BETWEEN ('01-May-2024', '01-Dec-2023') * 30), 0) num_of_days FROM DUAL;  

Output:

  	NUM_OF_DAYS
1	150

Improve this sample solution and post your code through Disqus.

Previous: Write a Oracle SQL statement to get the number of days in current month.
Next: Write a Oracle SQL statement to get the start date and end date of each month in current year from current month.

What is the difficulty level of this exercise?