Files Delphi

Title: Set date/time of the file
Use FileSetDate function for changing date and time of the file. FileOpen functions returns handle of the file. Result of this function is modified by conversions functions.
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
Edit1.Text:=OpenDialog1.FileName;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
HFile: Word;
MyDate: TDateTime;
MyDate2: Integer;
begin
HFile:=FileOpen(Edit1.Text, fmOpenWrite);
MyDate:=StrToDateTime(Edit2.Text);
MyDate2:=DateTimeToFileDate(MyDate);
FileSetDate(HFile, MyDate2);
FileClose(HFile);
end;