Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to convert seconds to hours and decimals

Author  Topic 

fengfeng
Yak Posting Veteran

64 Posts

Posted - 2010-07-20 : 13:14:38
The database stores time in seconds, how can I convert seconds into hours. Example: 900652 seconds converted into hours is 250.18111111

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-20 : 13:16:50
To convert seconds into hours, divide seconds by 3600.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-20 : 22:18:45
if you are doing it in T-SQL, you need to divide by 3600.0 to get the hours in decimals

select 900652 / 3600, 900652 / 3600.0



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -