Page 1 of 1

SQlite : How to store ms in TTIme and TDateTime fields ?

Posted: Tue 19 May 2015 08:22
by swierzbicki
Hello,

I've an issue with SQLite where milliseconds aren't stored into the database.
How can I store ms H in TTIme and TDateTime fields ?

Thank you

Re: SQlite : How to store ms in TTIme and TDateTime fields ?

Posted: Tue 19 May 2015 09:40
by AlexP
Hello,

Below is a sample of using TimeStamp:

Code: Select all

CREATE TABLE T_TS(F_TS TIMESTAMP);
...
UniQuery.SQL.Text := 'SELECT * FROM T_TS';
UniQuery.Open;
UniQuery.Append;
UniQuery.FieldByName('F_TS').AsSQLTimeStamp := DateTimeToSQLTimeStamp(now);
UniQuery.Post;
ShowMessage(SQLTimeStampToStr('yyyy-MM-dd HH:mm:ss Z', UniQuery.FieldByName('F_TS').AsSQLTimeStamp);