CreationTime: DateTime;
The CreationTime property determines date and time of file creation.
Sub UserProc;
Var
FileSInfo: IFileSystemInfo;
Begin
FileSInfo := New FileInfo.Attach("c:\1.txt");
If FileSInfo.Exists Then
Debug.WriteLine("Creation date: " + FileSInfo.CreationTime.ToString);
Debug.WriteLine("Date of the last opening: " + FileSInfo.LastAccessTime.ToString);
FileSInfo.LastWriteTime := DateTime.Now;
End If;
Dispose FileSInfo;
End Sub UserProc;
On executing the example the existence of the 1.txt file is checked. If the file exists, date and time of its creation and of its last opening are displayed in the development environment console. The current date is also set as date of the last change.
See also: