In Delphi (CIP Parser also) working with DateTime Functions has a Float representation.
Delphi DateTime value is the number of days that have passed since December 30, 1899.
December 30, 1899; 12:00 A.M
https://docwiki.embarcadero.com/Libraries/Athens/en/System.TDateTime
In MS SQL Server converted 0 Date represents:
1900-01-01 00:00:00.000
SELECT CAST(0 AS datetime)
That ends up in 2 days Difference. (Delphi Date is bigger with 48hrs).
Script Example:
SQLDate:=CIP_SQL("","SELECT CAST(CURRENT_TIMESTAMP AS DOUBLE PRECISION)");
CIPDate:=Now()*1.00;
Result:=CIPDate-SQLDate;
//Difference is about 2,0000000 days
Note: if You do something like this in for Pascal code, than the .AsFloat call will add the 2 Days automatically !!!
TempQuery.SQL.Text:='SELECT CURRENT_TIMESTAMP ';
TempQuery.Open;
if (not TempQuery.IsEmpty) then
Result := TempQuery.Fields[0].AsFloat;
TempQuery.Close;
Convention: in case of CIP, we store Delphi DateTime in DB, in Double Precision fields.