Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating Time Difference in Oracle 1

Status
Not open for further replies.

sitadba

IS-IT--Management
Jul 31, 2002
36
0
0
US
Hello All,

I'm trying to calculate the time difference between 2 datetime fields. Field 1 is open_time Field 2 is close_time, both are datetime fields.

I need to calculate the time difference between close_time and open_time in days and minutes.

If I do:

select (close_time-open_time) from dual;

I get the difference in the #of days. I need it in days and minutes.

If open_time = 1/21/2003 12:32:29 PM and
close_time = 1/23/2003 10:20:57 AM

I need the return to = 1 day, 11 hours & 28 minutes

Or I would be happy with total difference in minutes such as 2,128 minutes.

Any help would be appreciated.

Brgds,
Denise
 
(close_time - open_time) * 1440
will give you total minutes.

Elbert, CO
1344 MST
 
Thank you very much. This was exactly what I needed.

Brgds,
Denise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top