The following code in Delphi 2007 provides the correct integer value of 40909. When run in Delphi XE2 you get the response of 12/30/1899. How can this problem be resolved?
yy: word;
mm: word;
dd: word;
Jan1: TDateTime;
begin
Y := 2012;
M := 1;
D := 1;
Jan1 := EncodeDate(Y,M,D);
yy: word;
mm: word;
dd: word;
Jan1: TDateTime;
begin
Y := 2012;
M := 1;
D := 1;
Jan1 := EncodeDate(Y,M,D);