sql server - Cannot get hours to total over 24, eg 48 hours in hh:mm:ss output -


i running query find out total amount of time user has been browsing for. each browsing session stored in db seconds , sum total seconds , convert hh:mm:ss. problem when i'm converting seconds hh:mm:ss. want display example '78:20:00' dont know how code total this. when gets past 24 hrs hrs column goes 00 because day.

the query run convert time can seen below:

select username,        convert(varchar(12),dateadd(second,totaltimeinseconds,0),108) totalhours #totalsessiontime 

select username,        cast(totaltimeinseconds / (60 * 60) varchar) + ':' +         cast(totaltimeinseconds % (60 * 60) / 60 varchar) + ':' +        cast(totaltimeinseconds % (60) varchar)          totalhours   #totalsessiontime 

if want minutes , seconds 2 digits, you'll have left pad them, make ugly example, work fine.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -