Subject Re: [IBO] DateTime and IBOQuery
Author Helen Borrie (TeamIBO)
At 02:04 PM 25-04-02 +0100, Steve Lee-Woolf wrote:
>Perhaps someone can point me in the right direction here. I am using an
>app written in Delphi 6 with IBO to access a FireBird 1.0 database and
>am having trouble with datetime fields.
>If I use an external SQL tool to insert data into a DateTime field using
>the SQL statement:
>insert into table1 (test1) values ('2002-04-23 23:15:21') - where
>test1 is a DateTime field
>there is no problem, the data is correctly inserted.

Yes, because you have used a date literal representing a date format which
Firebird recognises.

>BUT if I use the
>same statement in an IBOQuery *albeit as a paramaterised query with the
>datetime value read from a DBGrid connectd to a .CSV text file, I get an
>error message:
>'2002-04-23 23:15:21' is not a valid date and time
>Can anyone tell me what is wrong here? the same code worked fine on the
>original database (MYSQL) but is causing problems when I try and port it
>to Firebird.

IBO's default date format is MM/DD/YY. Simply go to ib_constants.pas and
replace this line:
DT_DateFormat = 'MM"/"dd"/"yyyy';
DT_DateFormat = 'yyyy"-"MM"-"dd';

If you are using an Eval version, you probably don't have the source for
ib_constants.pas. If this is the case, send me a private email, telling me
which exact version of IBO you are using (read the Version property of your
TIBODatabase in the IDE) and I'll send you the .pas file.

Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at