Running this code in Delphi 7 gives the exception below:

var
  V: Variant;
  D: TDateTime;
begin
ShortDateFormat := 'dd/mm/yyyy'; // the problem occurs regardless of the format option
  V := '20/04/2011';
  D := V;
Memo1.Lines.Add('Date: ' + DateToStr(D)); // required to avoid dead code elimination
end;

raised exception class EVariantTypeCastError with message 'Could not convert variant of type (String) into type (Double)'

Can someone check with more recent Delphi if this is still true?
In DelphiXE:
raised exception class EVariantTypeCastError with message 'Could not convert variant of type (UnicodeString) into type (Double)'

Laco.

_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to