SQL Server Performance

Converting seconds to Hours

Discussion in 'T-SQL Performance Tuning for Developers' started by latingntlman, Mar 12, 2008.

  1. latingntlman New Member

    I'm developing Telephony interaction Reports by reporting on our agents and their times on the phone, however, data shows time as seconds, so for example: agent 1 shows total interaction time of 15794 seconds for a specific week. I just happen to know that in Hours it would be 4 hours 23 minutes 14 seconds (4:23:14). My problem is trying to convert or use a function that will return the result in parenthesis. Can anyone assist in providing a syntax or function that I may be able to save. thx, John
  2. ranjitjain New Member

    Hi,
    consider this:select
    15794/3600 hours,(15794%3600)/60 minutes,(15794%3600)%60 secondsselect
    '{'+convert(varchar(10),15794/3600) +':'+convert(varchar(10),(15794%3600)/60) +':'+convert(varchar(10),(15794%3600)%60 )+'}'

Share This Page