Oracle / PLSQL: Retrieve the total elapsed time in minutes between two dates
Question: In Oracle, how can I retrieve the total elapsed time in minutes between two dates?
Answer: To retrieve the total elapsed time in minutes, you can execute the following SQL:
select (endingDateTime - startingDateTime) * 1440 from table_name;
Since taking the difference between two dates in Oracle returns the difference in fractional days, you need to multiply the result by 1440 to translate your result into elapsed minutes.
24 * 60 = 1440
24 hours in a day * 60 minutes in an hour
No comments:
Post a Comment