Discussion Locked

Date Difference in Hours in SQL

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Could someone help me in identifying number of hours between two given dates in a single SQL using Oracle RDBMS.

3 replies

by basit_jafri

Thats pretty simple man

all the answers to date differences are returned in number of days by default in oracle.

so if field D2 and D1 contain 2 date elements, then D2-D1 will return number of days even it is less than a day.

Every day has24 hours then ur statement to get no of hours between two statemsnts should be

SELECT (DATE2 - DATE1 ) * 24 FROM TABLE

this is the simplest and effective way to do this, hope ur satisfied

BA

This discussion is closed to new replies.