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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subtracting two dates

Status
Not open for further replies.

mhamilton3

Programmer
Oct 31, 2001
129
Hello all,
I have to subtract two dates and get the results in hours, minutes, and seconds. It seems like such a simple question, but I can not get things to come out the way I want them to. I am not on 4.1.1 yet (4.0.18) so I can not use the new functions. Any suggestions?
 
are plannning a pure sql approach or are you willing to use application logic to do the calc?

Bastien

Cat, the other other white meat
 
I'll take whatever I can get - post SQL calculations are cool with me if you have one. Thanks
 
select sec_to_time(
time_to_sec(columna)
- time_to_sec(columnb)
) as elapsed_time

if the difference is greater than 24 hours, you will have to subtract whole days out first

(holler if you want the sql for that too)

rudy
SQL Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top