Hi,
Working with time in DB datetime format (example : '30.12.1899 09:18:54') on Android Delphi 10.3 throws exception- sTimespanTooLong. On Windows (and previous Delphi version) is OK.
class function TTimeSpan.GetScaledInterval(Value: Double; Scale: Integer): TTimeSpan;
var
NewVal: Double;
begin
if IsNan(Value) then
raise EArgumentException.Create(sTimespanValueCannotBeNan);
NewVal := Value * Scale;
if Value >= 0.0 then
NewVal := NewVal + 0.5
else
NewVal := NewVal - 0.5;
if (NewVal > MaxMilliseconds) or (NewVal < MinMilliseconds) then
raise EArgumentOutOfRangeException.Create(sTimespanTooLong);
Result := TTimeSpan.Create(Trunc(NewVal) * TicksPerMillisecond);
end;
How to set initial datetime for Android ?
WorkAround is simple, but ugly
if (NewVal > MaxMilliseconds) then
NewVal:=MaxMilliseconds;
if (NewVal < MinMilliseconds) then
NewVal:=MinMilliseconds;
Regards,
Marjan