SetFileTimes function
Date/Time routines
Return to Introduction  Previous page  Next page
Unit
acUtils  

Declaration
function SetFileTimes(const FileName: String;  
  Created, Modified, Accessed: TDateTime): Boolean;  

Description
The SetFileTimes procedure used to set the time labels for the file specified in FileName parameter. You can specify the time at which the file was last modified, accessed and when the file has been created. Function returns True if succeed or False otherwise.  
 
tip If you don't want to modify some of these time values, just set the parameter to -1. For example, you would like to change the time at which the file was created but leave the time of last access and modification untouched. Then simply specify the Created parameter and set Modified and Accessed parameters to -1, as shown in following example:  
SetFileTimes('c:\autoexec.bat', Now, -1-1);  

See also
DateTimeToFileTime and FileTimeToDateTime routines.