Page 1 of 1

Extended Date Time format

Posted: Sun 10 Jan 2016 00:52
by m227
Dear Sirs,
When I try to insert DATETIME value with query like this:

Code: Select all

INSERT INTO dummy VALUES ("2013-10-07T04:23:19+00:00");
I get error. However using such format is allowed by SQLite (https://www.sqlite.org/lang_datefunc.html). Does LiteDAC support such format (I use 2.5.14 version)?
Michal

Re: Extended Date Time format

Posted: Mon 11 Jan 2016 10:20
by MaximG
We have checked LiteDAC functioning (versions 2.5.14 and 2.6.20) with DateTime fields - and haven't found any problems when inserting the value "2013-10-07T04:23:19+00:00" . For the further investigation, please send us a small example that demonstrates the problem, including a test DB. You can send to maximg*devart*com

Re: Extended Date Time format

Posted: Mon 11 Jan 2016 16:02
by m227
Maxim, I sent you sample to your mail box. M.

Re: Extended Date Time format

Posted: Tue 12 Jan 2016 13:42
by MaximG
We have received your application, checked its functioning and found no problems. Please answer the following questions for the further investigation:

a) What exact error do you get in your application ?
b) Does the error appear on record insert or on reading of the inserted value ?

In addition, please let us know the parameter values of your OS regional settings: date and time format, etc.

Re: Extended Date Time format

Posted: Tue 12 Jan 2016 14:16
by m227
Dear Maxim,
I found out that the problem occurs only on my Delphi 2006. The same source ran on XE2 works perfectly. So this must be connected with some internal functions of D2006. And I was not precise enough. There is no error, but conversion creates date 1899-12-30 so it is probably 0 value.
Date format is common: "2016-01-12 15:18:50", decimal separator is ",".
Michal

Re: Extended Date Time format

Posted: Wed 13 Jan 2016 14:31
by MaximG
We have investigated the issue and found out, that the error occurs not due to bugs in LiteDAC, but due to disadvantages of processing DateTime in early Delphi versions.
This can be demonstrated with a simple console application:

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  FmtSet: TFormatSettings;
  d: TDateTime;

begin
  try
    FmtSet.DateSeparator := '-';
    FmtSet.TimeSeparator := ':';
    FmtSet.ShortDateFormat := 'yyyy-mm-dd';
    FmtSet.ShortTimeFormat := 'hh:nn:ss';

    d := StrToDateTimeDef('2016-12-30T02:39:54+00:00', 0, FmtSet);
    Writeln(DateTimeToStr(d));
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.
If you execute this application in Delphi 2006 and Delphi XE2, you can see that such DateTime format in Delphi 2006 is not processed correctly. We will try to avoid this limitation of early Delphi versions and add a fix in one of the next LiteDAC builds.