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.
| Author |
Topic |
|
amodi
Yak Posting Veteran
83 Posts |
Posted - 2009-08-29 : 16:11:38
|
| Hello Friends,I have a column that contains seconds, I want to display that seconds in the following format : HH:MM:SSFor example:if i have 9906 seconds then i want it as 02:45:06Thanks. |
|
|
amodi
Yak Posting Veteran
83 Posts |
Posted - 2009-08-29 : 16:25:26
|
| Hello Friends,I tried the following:seconds = 9906convert(varchar,9906/(3600)) + ':'+convert(varchar,9906%(3600)/60)+':'+convert(varchar,9906%60) output: 2:45:6 Is it possible to the output as 02:45:06 ???Thanks |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-08-29 : 16:41:37
|
| [code]right(('00' + convert(varchar,9906/(3600))),2) + ':'+right(('00'+ convert(varchar,9906%(3600)/60)),2)+':'+ right(('00'+convert(varchar,9906%60)),2)[/code] |
 |
|
|
amodi
Yak Posting Veteran
83 Posts |
Posted - 2009-08-29 : 17:05:04
|
| Thanks vijay. It works! |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-08-29 : 17:09:06
|
welcome |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-31 : 02:35:50
|
| declare @time intset @time=9906 select convert(varchar(10),dateadd(second,@time,0),108)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|