Page 1 of 1

TDateTime and Access MDB

Posted: 24.03.2015, 14:24
by Dali
Hello!

Sorry for bringing this back to life but I'd like to know if there is a solution.

I'm facing exactly this issue, now closed because it was related to a previous beta version of the Zeos components:

viewtopic.php?f=33&t=3596

Example:

Code: Select all

zquery.fieldByName('CREATION_TIME').asDateTime := now;
showmessage(formatdatetime('yyyy/mm/dd hh:mm:ss', now));
showmessage(formatdatetime('yyyy/mm/dd hh:mm:ss', zquery.fieldByName('CREATION_TIME').asDateTime));


The first message shows a correct date and time, for instance '2015/03/24 14:22:31'.

However, the second one returns only the date part and not the time (asDateTime is storing and returning only integers and not doubles as it should): '2015/03/24 00:00'.

This is happening with Zeos v7.2, Lazarus v1.5, FPC 3.1, all of them from SVN. With Delphi 6 and native ADO components it works against the same MDB database (tested using the same app but compiled before it was ported to Lazarus+Zeos, I don't have the original sources anymore and I wouldn't like to go back to that environment either).

Re: TDateTime and Access MDB

Posted: 24.03.2015, 14:50
by Dali
Another thread, this one even older, depicting the same situation:

viewtopic.php?f=33&t=2818&p=13439

This solution of changing ZDBCADOUtils in this way:

Code: Select all

function ConvertAdoToSqlType(FieldType: SmallInt): TZSQLType;
begin
  case FieldType of
  ...
    adDate : Result := stTimestamp; // stDate; <--- DOESN'T WORK AS EXPECTED
  ...


... Does the trick for me, because I don't need connections in design time for this project.