Alex,
here is what I did:
-- create table which stores timestamp, and force it to be correct
datetime value:
CREATE TABLE "mytab" (
aaa TIMESTAMP UNIQUE NOT NULL CHECK (datetime(aaa) IS NOT NULL)
);
and then, for example:
INSERT INTO mytab (aaa) VALUES (datetime("now", "localtime",
"+3hour"));
if you try to do something illegal, like inserting a incorrect string,
you get SQL error.
It is (almost) always better to implement data consistency in lower
layer, so nobody can insert wrong data into table.
Also note, that sqlite has dynamic data typing, so normally (without
CHECK () clause) you are able to inser *any* value into Timestamp
field.
Best Regards,
Michal Šrajer
On Feb 17, 8:47 am, Alex <[email protected]> wrote:
> Hi all,
>
> how to store datetime data in gears database (sqlite3) ?
>
> Thank you !
>
> Alex