SPECIAL OFFER        Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming!

⤷ 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;
Related components
TFileSearch
TFolderMonitor
TFileVersion
More for developers
Databases for Amazon Associates
Amazon Categories
Amazon Nodes