Page 1 of 1

SQLite provider does not store milliseconds when field type is DATETIME

Posted: Tue 19 Sep 2017 11:31
by m227
Hi,
i have milliseconds equal to zero when I reconnect to my SQLite Database, and try to read DATETIME field, where I set milliseconds previously too. When I put milliseconds from a SQLite client to the same table, they are retained. Is it expected behaviour?

My code snippet:

Code: Select all

    Edit;
    FieldByName('Updated').AsSQLTimeStamp := DateTimeToSQLTimeStamp(Modified);
    Post;

Re: SQLite provider does not store milliseconds when field type is DATETIME

Posted: Wed 20 Sep 2017 07:14
by MaximG
Please specify what type in SQLite table has the 'Updated' field.

Re: SQLite provider does not store milliseconds when field type is DATETIME

Posted: Wed 20 Sep 2017 13:27
by m227
the field definition is:
Updated DATETIME NULL

Re: SQLite provider does not store milliseconds when field type is DATETIME

Posted: Thu 21 Sep 2017 09:55
by MaximG
When working with values of the DateTime type, by default, LiteDAC uses the following format to present such values : 'hh:nn:ss' You can change the format string using the LiteConnection.Options.TimeFormat property :
https://www.devart.com/litedac/docs/?de ... format.htm
For example, to present milliseconds with three digits :

Code: Select all

LiteConnection.Options.TimeFormat := LiteConnection.Options.TimeFormat := 'hh:nn:ss.zzz';
Detailed description of format specifier is available at: http://docwiki.embarcadero.com/Librarie ... atDateTime