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

Calculate Time 1

Status
Not open for further replies.

heydyrtt

Programmer
Dec 12, 2001
63
US
Have a table with a starttime and endtime, need a query that will tell me how much time was spent using starttime and the endtime. If the start time is 11:00 am and endtime is 1:00 pm I need the query to display that it took 2 hours.


Thanks



Heydyrtt
 
What data types are starttime and endtime?

What queries have you tried so far and what where the results?

Andrew
Hampshire, UK
 
if the datatypes are times,
Code:
select sec_to_time(
       time_to_sec(endtime)
      -time_to_sec(starttime)
                  ) as elapsed_time
  from yourtable

rudy
SQL Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top