What is the equivalent of DATEDIFF in Oracle?

What is the equivalent of DATEDIFF in Oracle?

DATEDIFF is a common function in the SQL Server to find the number of days between two dates. Oracle offers its own solution, although does not have the DATEDIFF function.

What's the function in Oracle that would be the equivalent to DATEDIFF in the SQL Server?

On Oracle, it is an arithmetic issue:

  1. Select DATE1-DATE2 from dual 
  2. Use trunc() for the number of days.

Otherwise, multiply the value:

  • by 24 for hours
  • by 1440 for minutes
  • by 86400 for seconds
Do you need more help with SQL server? Check out our forum!
Around the same subject