dbTalk Databases Forums  

Problem converting float to datetime

comp.database.ms-sqlserver comp.database.ms-sqlserver


Discuss Problem converting float to datetime in the comp.database.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
BobAndersson (Offline)
Junior Member
 
Posts: 1
Join Date: May 2006

Default Problem converting float to datetime - 05-04-2006 , 08:31 AM






Hi

I have problems when converting a float value to a datetime value in the SQL clause on a SQL Server 2005. The date always is two days wrong, e.g. two days past the correct date. The time value is correct.

Converting the same value in MS Excel to a date or using a DataReader in my VB.NET code like:
DateTime.FromOADate(dr("MyFloatField"))
gives the correct date, but converting the float value in the SQL caluse like:

SELECT CONVERT(datetime, MyFloatField, 126)
FROM MyTable

gives a date that is two days past the correct one.

Is this a bug in SQL Server 2005?

-BA-

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.