DATEDIFF équivalent en Oracle

Solved
OlivrT Posted messages 323 Registration date   Status Membre Last intervention   -  
 dev_il -
Hello,
does anyone have a function in Oracle that is equivalent to DATEDIFF from SqlServer?
Unless I am mistaken, it does not exist in Oracle.
I would like to know the difference that can exist between two dates, whether in months, days, hours, or minutes, ...

Thank you in advance

Configuration: Windows XP / Firefox 3.5.5

1 réponse

Krysstof Posted messages 1659 Status Membre 295
 
On Oracle, you just need to perform an arithmetic operation

select DATE1-DATE2 from dual

1 = 1 day, the digits after the decimal represent fractions of days.

Use trunc() to get the number of days

Otherwise, multiply the decimal value
by 24 for hours
by 1440 for minutes
by 86400 for seconds
8
OlivrT Posted messages 323 Registration date   Status Membre Last intervention   36
 
Thank you! I'm stunned that it doesn't exist natively in Oracle, I will create the function.
0
Krysstof Posted messages 1659 Status Membre 295
 
well, the oracle function is more logical than the datediff function, but it's a matter of perspective ^^
0
dev_il
 
Thanks ;D
0