Board index » delphi » DateTime problem using SQLServer

DateTime problem using SQLServer

Converting the value zero in Delphi to a date returns 31-Dec-1899 but in
SQLServer converting date zero returns 01-Jan-1900.

Can one set Delphi DateDelta contant to correct the problem, or is their any
other way of fixing this bug.

 

Re:DateTime problem using SQLServer


I ran into this a while ago and the response I got was to do either one of
two things:

1) Send the date broken down into it's components  (ie YEAR/MONTH/DAY)
2) Send the date as a string

For queries I like the first option as it guarantees me all transactions for
the day while the second is time specific (ie you have to enter the query
with time values included in the string 00:01 to 24:00)
If you use your decodedate in Delphi to get the values for the parameters
everything will work fine.

By the way it was explained that the date difference has to do with the
starting date used by SQL Server and is not a bug. Apparently you could also
get different results from Oracle or MS Access.  So better follow a route
that you know will always get you the correct results

Regards
Kelvin Taite
Provincial Airlines Ltd.
kta...@provair.com

Quote
"WC" <w...@aquaonline.com> wrote in message

news:915fep$67310@bornews.inprise.com...
Quote
> Converting the value zero in Delphi to a date returns 31-Dec-1899 but in
> SQLServer converting date zero returns 01-Jan-1900.

> Can one set Delphi DateDelta contant to correct the problem, or is their
any
> other way of fixing this bug.

Other Threads