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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 format seconds to hour

Author  Topic 

simplymidori
Starting Member

9 Posts

Posted - 2008-01-30 : 07:48:59
I'm currently using this function and have a looking for a specific format - I want my data to show 06:00 instead of 6:00.


CONVERT (varchar(6), STARTTIME / 3600) + ':' + RIGHT ('0' + CONVERT (varchar(3), STARTTIME % 3600 / 60), 2)

Any suggestions?

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-30 : 07:52:05
[code]right('00' + CONVERT (varchar(6), STARTTIME / 3600), 2)[/code]


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

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-01-30 : 08:18:59
SELECT CONVERT(CHAR(5), DATEADD(SECOND, Col1, '19000101'), 108)
FROM Table1




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-30 : 09:29:36
If you use front end, then

Format(datetimecol ,"HH:SS")

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -