SQLite provider does not store milliseconds when field type is DATETIME

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
m227
Posts: 75
Joined: Mon 06 Aug 2007 12:41

SQLite provider does not store milliseconds when field type is DATETIME

Post by m227 » Tue 19 Sep 2017 11:31

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;

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

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

Post by MaximG » Wed 20 Sep 2017 07:14

Please specify what type in SQLite table has the 'Updated' field.

m227
Posts: 75
Joined: Mon 06 Aug 2007 12:41

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

Post by m227 » Wed 20 Sep 2017 13:27

the field definition is:
Updated DATETIME NULL

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

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

Post by MaximG » Thu 21 Sep 2017 09:55

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

Post Reply