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 2005 Forums
 Transact-SQL (2005)
 proper format

Author  Topic 

harshad
Starting Member

1 Post

Posted - 2008-11-13 : 07:21:34
hi i want to convet time which is not in proper format
please tell the way to do it

i have 5.90 which means 6.30
here we need to convert .90 to 1.30
please how to do that

thanks in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-13 : 07:25:27
5.90 is 5 hours 90 minutes? Which is 6 hours 30 minutes?
0.90 is 0 hours 90 minutes? Which is 1 hour 30 minutes?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-13 : 07:28:10
[code]DECLARE @Sample TABLE
(
data SMALLMONEY
)

INSERT @Sample
SELECT 5.90 UNION ALL
SELECT .90

SELECT data,
CONVERT(CHAR(5), DATEADD(MINUTE, FLOOR(data) * 60 + 100 * data % 100, 0), 108)
FROM @Sample[/code]


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -