[fpc-devel] Behavior of conversion between vardate variants and string in fpc and delphi
LacaK
lacak at zoznam.sk
Mon Apr 4 09:04:00 CEST 2011
>
> 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.
More information about the fpc-devel
mailing list