SysUtilsFileGetSetDate (Delphi)
Description
This example illustrates the FileGetDate and FileSetDate functions from the SysUtils unit. In the case of a file named "test.txt", first get the date and time from that file, and then change it.
Code
var
LH: THandle;
LFDate: Integer;
begin
{ Open a file. }
LH := FileOpen('test.txt', fmOpenRead);
{ Get the date from the file. }
LFDate := FileGetDate(LH);
{ Close the file. }
FileClose(LH);
{ Increment the old date by one hour, then apply the new date. }
FileSetDate('test.txt',
DateTimeToFileDate(
IncHour(FileDateToDateTime(LFDate), 1)));
end.
Uses
- System.SysUtils.FileGetDate ( fr | de | ja )
- System.SysUtils.FileSetDate ( fr | de | ja )
- System.SysUtils.FileDateToDateTime ( fr | de | ja )
- System.DateUtils.IncHour ( fr | de | ja )