Erro ao converter StrToDateTime no delphi mobile IOS

Exceção ao converter String em TDateTime em um TCriteria.List .

trecho do código fonte:
na função que uso
var
ACriteria: TCriteria;
AManager: TObjectManager;
begin
Result := nil;
AManager := GetNewManager;
ACriteria := AManager.CreateCriteria(TUsuarioEmpresa);
With ACriteria do begin
CreateAlias('Usuario', 'Usuario');
CreateAlias('EmpresaAcesso', 'EmpresaAcesso');
Add(TLinq.Eq('Usuario.Login', _ALogin));
Add(TLinq.Eq('Usuario.Senha', TFuncoes.getFuncoes.Criptar(_ASenha)) or TLinq.Eq('Usuario.Senha', _ASenha));
AddOrder(TOrder.Asc('EmpresaAcesso.Chave'));
end;

  Result := ACriteria.List<TUsuarioEmpresa>;

end;

Exceção dentro da Unit Aurelius.Global.Utils;
Segue função onde ocorre:

unit Aurelius.Global.Utils;

class function TUtils.ISOToDateTime(const Value: string): TDateTime;
var
Fmt: TFormatSettings;
begin
if Value = '' then Exit(0);
Fmt.ShortDateFormat := 'YYYY-mm-dd';
Fmt.DateSeparator := '-';
Fmt.ShortTimeFormat := 'hh:nn:ss.zzz';
Fmt.TimeSeparator := ':';
Fmt.DecimalSeparator := '.';
Fmt.TimeAMString := 'AM';
Fmt.TimePMString := 'PM';
Result := StrToDateTime(Value, Fmt); // except here
end;

Exception : ''19/02/2022 11:16:31' is not a valid date and time'

My guess is that you are using SQLite database? It looks like your date field in the database has a string value with a date format not recognized by Aurelius.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.