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)
 Conversion from DateTime type to float type

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-09-26 : 07:52:08
Yaniv writes "I have a problem I'm converting datetime to float using " select convert(float,getdate())" or " select cast (getdate() as float)"

And the float number that I get is of the date 2 days back.

I understand that this is a known problem, is there any solution.

I'm using SQL 2k sp3.



Many thanks,

Yaniv

"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-09-26 : 07:52:39
Ummm, yeah, don't convert datetime values to float.
Go to Top of Page

dsdeming

479 Posts

Posted - 2003-09-26 : 09:01:15
When I run the following, I don't see the kind of conversion problems you're talking about:

select getdate(), cast( cast( getdate() as float ) as datetime )



Dennis
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2003-09-26 : 11:21:36
I'm with Rob. What are you trying to do that requires you to convert a datetime to a float? I've converted datetimes to varchar for display purposes, but never to float. There is such a thing as "date math" that allows you to add hours, days, etc. without having to convert it first.

------------------------------------------------------
The more you know, the more you know you don't know.
Go to Top of Page
   

- Advertisement -