Description |
The creation date and time of the specified PathString is returned as a DateTime value. This can actually specify a directory (folder) as well as a file.
|
| Notes | An exception is thrown if the PathString path is not found.
Static methods are not methods of an object - they are simply class functions or procedures available at any time.
|
| References | DateTime
|
|
Microsoft MSDN Links |
System.IO
System.IO.File
|
|
|
Create a new File and get its creation date and time |
program Project1;
{$APPTYPE CONSOLE}
uses
System.IO;
var
Path : String;
Writer : StreamWriter;
begin
// Create a text file
Path := 'C:\DelphiBasics.txt';
Writer := System.IO.File.CreateText(Path);
// Close the file
Writer.Close;
// Show the creation date and time
Console.WriteLine(System.IO.File.GetCreationTime(Path));
// Now delete this file
System.IO.File.Delete(Path);
Console.Readline;
end.
| Show full unit code | 23/09/2004 10:11:14
|
|
|
|