On 4/4/2011 04:34, LacaK wrote:
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 sh
On 4/4/2011 02:28, Sergei Gorelkin wrote:
Unfortunately I don't have recent Delphi, but here are results of some
quick testing with Delphi 7:
a) Only *assignment* Variant -> TDateTime is broken, explicit casting
(e.g. VarAsType(v, varDate)) works.
b) Conversion is done using Windows API (in
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 var
Running this code in Delphi 7 gives the exception below:
var
V: Variant;
D: TDateTime;
begin
ShortDateFormat := 'dd/mm/'; // 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
Luiz Americo Pereira Camara пишет:
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
Hi,
As pointed in bug http://bugs.freepascal.org/view.php?id=19075
converting from vardate variants (variants with TDateTime values) to
string is done differently in Delphi and fpc. According to
http://support.embarcadero.com/article/35913 the conversion is done with
the default OS format opt