ODBC , date in Informix
Posted in 1999
Topics: Connectivity: ODBC / JDBC / .NET
When I try to fire a select that uses a Date-format ('yyyy-mm-dd') , it
give me the wrong records ,
Select * from XXX where date = 1975-12-30 , gives me the records where thedate is 1905-10-17 ...
I did not have the time to look it up , so I am asking if somebody could
explain , what the format is in ODBC , if i want to use DATE-values ...
Hoping you can help me ...
Filip Wtterwulghe
Infohos
Hi,
I'm using INFORMIX-CLI 2.5. on WINNT 4.0..
Select the INFORMIX SETNET 32 utility. In the INFORMIX client server
environment set the DBDATE variable to the date-format you wish to use (Y4MD-).
I hope this may help you.
Kind regards,
Carlo Haller
Infohos wrote:
> When I try to fire a select that uses a Date-format ('yyyy-mm-dd') , it
> give me the wrong records ,
> Select * from XXX where date = 1975-12-30 , gives me the records where the> date is 1905-10-17 ...
>
> I did not have the time to look it up , so I am asking if somebody could
> explain , what the format is in ODBC , if i want to use DATE-values ...
>
> Hoping you can help me ...
>
> Filip Wtterwulghe
> Infohos
In article <01be600d$17ff4800$78470180@ihpcinter>,
"Infohos" <infohos@unicall.be> wrote:
> When I try to fire a select that uses a Date-format ('yyyy-mm-dd') , it
> give me the wrong records ,
> Select * from XXX where date = 1975-12-30 , gives me the records where the> date is 1905-10-17 ...
>
> I did not have the time to look it up , so I am asking if somebody could
> explain , what the format is in ODBC , if i want to use DATE-values ...
>
> Hoping you can help me ...
>
> Filip Wtterwulghe
> Infohos
>
>
This may be due more to the way Informix stores dates rather than a
misunderstanding with ODBC formats. Informix stores dates as the number of
days since '1899-12-31'. Make sure you add quotes around the date value.
Without quotes, Informix sees the value you used as an expression which
equates to 1,933 rather than a string representation of a date. By my quick
calculation, 1,933 days after '1899-12-31' works out to be more like
'1905-03-17', but it is close to the results you are seeing.
Steve Yates
OneNet ICI
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own