So, what should be done?

1) Be totally compatible with Delphi: convert date to string with hardcoded format and raise exception when doing the conversion back? 2) Use the hardcoded format used to convert from vardate variant to string and vice versa? 3) Use shortdateformat to convert from vardate variant to string and vice versa?
Point 3 sounds to me as best and logical.

This code in DelphiXE:

ShortDateFormat := 'dd#mm#yyyy'; // the problem occurs regardless of the format option
  DateSeparator:='#';
  V := '20#04#2011';
  v1:=varAsType(V, varDate);
  D:=v1;
  Writeln('Date: ' + DateToStr(D));

Outputs:
Date: 20#04#2011

So it seems, that DelphiXe also uses ShortDateFormat, DateSeparator

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

Reply via email to