You are not logged in.
Pages: 1
Hello,
I am using Delphi 12.2, mORMot from GitHub January 3, 2025 update.
Is it possible to have mORMot2 de-serialize to auto convert Unix Time (with/without milliseconds) Int64 values to TDateTime?
uses
System.DateUtils, mormot.core.json, mormot.core.base;
type
TTest = packed record
ADate: TDateTime;
end;
procedure TForm1.FormCreate(Sender: TObject);
const cTest = '{"adate":1736705403567}'; // with milliseconds
var LRec: TTest;
begin
mormot.core.json.RecordLoadJson(LRec, RawUtf8(cTest), TypeInfo(TTest));
ShowMessage(LRec.ADate.ToString());
end;
Above code cause an overflow (if turned on)
Thanks & Regards,
Ertan
Offline
Good idea.
Please try
https://github.com/synopse/mORMot2/commit/258fd6fdf
Offline
That's working.
Thank you.
Offline
Pages: 1