The essence in the following:
procedure TForm1.Button1Click(Sender: TObject);
var
cfile: TInifile;
Date1: TDateTime;
begin
Date1 := IncYear(Now, -50);
cfile := TInifile.Create(ExtractFilePath(Application.ExeName) + 'Settings.ini');
try
cfile.WriteDateTime('Main', 'DateTime', Date1);
ShowMessage('Recorded in the ini file ' + DateTimeToStr(Date1));
Date1 := cfile.ReadDateTime('Main', 'DateTime', Now);
ShowMessage('Read from ini file ' + DateTimeToStr(Date1));
finally
cfile.Free;
end;
end;
Entry in the ini file passes without problems. In the file is written to 04-Dec-63 17:28:14. Read also from ini file does not work, the message falls "04-Dec-63 17:28:14 is not a valid date and time".
Windows 7 Enterprise х32, Embarcadero Delphi XE Portable