MikeCallon
Programmer
Sorry if this is the wrong group but this is my first post - total newbie so please be gentle......
We have a SQL Server database where dates are stored as a float in a field called DT_StartDate (the dates are entered from a Visual Basic application running on various clients which use CDbl(Now) to convert the current date/time to a double).
If I create a VB executable and convert the value back to a date with CDate(DT_StartDate) I get the expected date.
If a do datepart(day,DT_StartDate) from query analyzer the day is 2 days out !
According to VB, the value 38104 is 27th April 2004
So in VB : CDate(38104) = 27/04/2004
SQL Server : SELECT datepart(day,38104) = 29 !!!!!
Anyone had a similar problem ?
I'm not sure why the dates are stored as float (I inherited this problem) - is this the cause of the problem ?
Any pointers would be greatly appreciated.
Cheers,
Mike
We have a SQL Server database where dates are stored as a float in a field called DT_StartDate (the dates are entered from a Visual Basic application running on various clients which use CDbl(Now) to convert the current date/time to a double).
If I create a VB executable and convert the value back to a date with CDate(DT_StartDate) I get the expected date.
If a do datepart(day,DT_StartDate) from query analyzer the day is 2 days out !
According to VB, the value 38104 is 27th April 2004
So in VB : CDate(38104) = 27/04/2004
SQL Server : SELECT datepart(day,38104) = 29 !!!!!
Anyone had a similar problem ?
I'm not sure why the dates are stored as float (I inherited this problem) - is this the cause of the problem ?
Any pointers would be greatly appreciated.
Cheers,
Mike