General discussion

Locked

Date Difference in Hours in SQL

By Sankar Srinivasan ·
Could someone help me in identifying number of hours between two given dates in a single SQL using Oracle RDBMS.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Date Difference in Hours in SQL

by basit_jafri In reply to Date Difference in Hours ...

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

Collapse -

Date Difference in Hours in SQL

by Sankar Srinivasan In reply to Date Difference in Hours ...

Poster rated this answer

Collapse -

Date Difference in Hours in SQL

by Sankar Srinivasan In reply to Date Difference in Hours ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Forums