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
 SQL Server Development (2000)
 converting float to timestamp

Author  Topic 

lauramayer
Posting Yak Master

152 Posts

Posted - 2004-08-30 : 13:45:04
Afternoon all,

I have a float field that I need to convert to a timestamp (military time). I can get to disaply date and time but the implicit conversion seems to escape me.

Any thoughts would be appreciated.

Thanks

Laura

X002548
Not Just a Number

15586 Posts

Posted - 2004-08-30 : 13:59:04
Like this?


DECLARE @x datetime, @y float
SELECT @x = GetDate(), @y = CONVERT(float,@x)
SELECT @x, @y, CONVERT(datetime,@y,120)





Brett

8-)
Go to Top of Page

lauramayer
Posting Yak Master

152 Posts

Posted - 2004-08-30 : 14:01:32
Sort of Brett. But the user just wants the time.

Laura
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-08-30 : 14:07:22
OK


DECLARE @x datetime, @y float
SELECT @x = GetDate(), @y = CONVERT(float,@x)
SELECT @x, @y, CONVERT(varchar(25),CONVERT(datetime,@y),114)




Brett

8-)
Go to Top of Page

lauramayer
Posting Yak Master

152 Posts

Posted - 2004-08-30 : 14:09:58
Ahhh thanks so much.

Laura
Go to Top of Page

lauramayer
Posting Yak Master

152 Posts

Posted - 2004-08-30 : 14:13:32
One more question if I may. Where would I put the field name I need to convert?

Laura
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-30 : 14:16:15
instead of @y

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

lauramayer
Posting Yak Master

152 Posts

Posted - 2004-08-30 : 14:16:45
nevermind :)
Go to Top of Page
   

- Advertisement -