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?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework