Subject Bug in IBO Gc when using german date format (with solution)!
Author likemike46
Hello,
I've found a bug in IBO when using german date format (IB_Constants):

DTEncode_DateDelimit = '.';
DTEncode_TimeDelimit = ':';
DTEncode_DateTimeDelimit = ' ';
DTEncode_DecodeFormat = '%.2u.%.2u.%.4u %.2u:%.2u:%.2u.%.3u0';
DTEncode_DateTimeFormat = 'DD"."MM"."YYYY" "HH":"NN":"SS".0000"';
DT_DateFormat = 'dd"."MM"."yyyy';
DT_TimeFormat = 'hh":"nn":"ss';

As you can see, in germany the sequence of a date is day, month and
year!
So the following two functions won't work in the actual source.
I've made some little modifications for german users in IB_Utils:

function DateTimeToEncodeString( ADateTime: TDateTime ): string;
var
Day, Month, Year, Hour, Minute, Second, MSec: word;
begin
Result := '';
if ADateTime > 0 then begin
DecodeDate( ADateTime, Year, Month, Day );
DecodeTime( ADateTime, Hour, Minute, Second, MSec );
Result := Format( DTEncode_DecodeFormat,
[Day,Month,Year,Hour,Minute,Second,MSec] ); // changed sequence
end else begin
Result := FormatDateTime( DTEncode_DateTimeFormat, ADateTime );
end;
end;

function EncodeStringToDateTime( AValue: string ): TDateTime;
var
Day, Month, Year, Hour, Minute, Second, MSec: word;
tmpStr: string;
begin
if AValue = '12/30/1899 00:00' then
Result := 0
else
try
Year := StrToInt( Copy(AValue,7,4) ); // change this
Month := StrToInt( Copy(AValue,4,2) ); // change this
Day := StrToInt( Copy(AValue,1,2) ); // change this
Hour := StrToInt( Copy(AValue,12,2) );
Minute := StrToInt( Copy(AValue,15,2) );
Second := StrToInt( Copy(AValue,18,2) );
tmpStr := Trim(Copy(AValue,21,4)) + '0000';
MSec := StrToInt( Copy(tmpStr,1,3) );
Result := EncodeDate( Year, Month, Day );
if Result >= 0 then
Result := Result + EncodeTime( Hour, Minute, Second, MSec )
else
Result := Result - EncodeTime( Hour, Minute, Second, MSec );
except
Result := StrToDateTime( AValue );
end;
end;


Hope it helps!

Best regards
Mike