Extended Date Time format

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

Extended Date Time format

Post by m227 » Sun 10 Jan 2016 00:52

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

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

Re: Extended Date Time format

Post by MaximG » Mon 11 Jan 2016 10:20

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

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

Re: Extended Date Time format

Post by m227 » Mon 11 Jan 2016 16:02

Maxim, I sent you sample to your mail box. M.

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

Re: Extended Date Time format

Post by MaximG » Tue 12 Jan 2016 13:42

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.

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

Re: Extended Date Time format

Post by m227 » Tue 12 Jan 2016 14:16

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

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

Re: Extended Date Time format

Post by MaximG » Wed 13 Jan 2016 14:31

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.

Post Reply