Page 1 of 1

How does UniDAC handle SQLite DateTime fields? [Urgent]

Posted: Fri 25 Nov 2011 10:53
by stevel
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.

Posted: Fri 25 Nov 2011 12:26
by AlexP
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.