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 |
|
zubair
Yak Posting Veteran
67 Posts |
Posted - 2009-12-02 : 10:05:28
|
| Hi,i have time values in a database which is entered as float for example 6.5, 6.0, 6.25Now I want to convert these values to a hour:min format like 6.50 should become 6:30 and 6.25 should become 6:15is there a way to do this or a sql function for this?Thanks |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-12-02 : 10:24:23
|
| There is no hour:min format in sql, but you can make those values look like times, but they will actually be stringsdeclare @hhmmin floatdeclare @hhmmin floatset @hhmmin = 6.1SELECT convert(varchar(5),dateadd(mi,@hhmmin*60,0),108)JimEveryday I learn something that somebody else already knew |
 |
|
|
zubair
Yak Posting Veteran
67 Posts |
Posted - 2009-12-02 : 11:09:57
|
| Thanks jim! just what i was lokking for |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|