How does UniDAC handle SQLite DateTime fields? [Urgent]

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

How does UniDAC handle SQLite DateTime fields? [Urgent]

Post by stevel » Fri 25 Nov 2011 10:53

I imported Access tables into a SQLite database using "Navicat for SQLite" tool. The "Date/Time" fields of Access were converted to "DATETIME" type in SQLite (can see in table designer of Navicat tool).

Further, when viewing the SQLite database table in Navicat, it can be observed that the date values were imported correctly into SQLite.

Using UniQuery component and SELECT statement, when iterating through result set the value for all rows of the converted column is:

12/30/1899

..which is an incorrect value, because it is different from the date in the table.

Using the following code to get the values in the date field:

Code: Select all

while not uq.Eof do
    begin

      ShowMessage( FormatDateTime('yyyy-mm-dd', uq.FieldByName('f').AsDateTime) )  ;

      uq.Next;
    end;

Please indicate:
1) What is wrong
2) Steps needed to debug and resolve
3) Example of how to get the correct value



TIA.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 25 Nov 2011 12:26

Hello,

We've added two parameters, DateFormat and TimedFormat, that are responsible for storing date and time in database to UniConnection to solve similar problems. To solve the problem, you need to specify correct date format, for example,

UniConnection.SpecificOptions.Values['DateFormat'] := 'dd.mm.yyyy';

P.S. The new UniDAC version is already available at our site.

Post Reply