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 |
|
krabople
Starting Member
17 Posts |
Posted - 2008-06-19 : 10:05:32
|
| Hi, I have a field with seconds in it, and I need to convert this so that it shows in the format hh:mm:ss. Is there an easy way to do this?Thanks in advance,Ben |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-19 : 10:11:45
|
| SELECT CAST(SecondsField/3600 AS varchar(10)) + ':' + CAST((SecondsField%3600)/60 AS varchar(10)) + ':' + CAST((SecondsField%3600)%60 AS varchar(10)) FROm table |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-19 : 10:13:13
|
[code]SELECT CONVERT(CHAR(8), DATEADD(SECOND, @Seconds, '00:00:00'), 108)[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
|
krabople
Starting Member
17 Posts |
Posted - 2008-06-19 : 10:21:19
|
| Perfect, thanks very much! Glad I posted on here before I wasted anymore time writing out stupidly long workarounds! |
 |
|
|
|
|
|