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)
 Converting Decimal to time?

Author  Topic 

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2005-03-02 : 06:40:41
I have a decimal which is the amount of minutes from midnight, can anyone tell me how to convert this back to a time format? Can't seem to work this out..

Thanks

Rick

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2005-03-02 : 07:21:46
No worries, I worked it out..

Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-03-02 : 07:24:51
Edit: Oh well, never mind then...

Try by converting the decimal value to seconds after midnight.

declare @m decimal(5,2)
set @m = 23.45
select dateadd(second,@m*60,floor(cast(getdate() as float)))

rockmoose
Go to Top of Page
   

- Advertisement -