'Oracle Database | Calculate Days in between two dates [duplicate]
I'm trying to calculate number of days in between to DATES stored in my database, but I was not able to get any data using DATEDIFF or Extract.
Brief Example:
TABLE (PROJECT) PROJECT START, PROJECT END
What I'm looking to get is the amount of days each project lasted.
Any hint will help!
Solution 1:[1]
When you subtract one date from another in Oracle, you get a decimal value. The numbers to the left of the decimal point are the days, the numbers to the right is the decimal fraction.
select sysdate - date '2022-01-03' as delta from dual;
The resulting value on the day I am running this is 37.65. Since you asked for days, I'll leave it to you to truncate this to 37 days or round it to 38.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Brian Leach |
