Home  |  Delphi .net Home  |  System.IO.File  |  SetLastAccessTime Method
  
SetLastAccessTime  
Method  
Sets the Last Access date and time of the specified file
File Class
System.IO NameSpace
NotCF1.  Procedure SetLastAccessTime ( PathString : String; DateAndTime : DateTime ) ; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
The last access date and time of the file specified by PathString is set to the DateAndTime value.
Notes
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
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
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 last access date and time
  Console.WriteLine(System.IO.File.GetLastAccessTime(Path));

  // Set the last access time
  System.IO.File.SetLastAccessTime(Path, DateTime.Create(2000, 1, 1));

  // Show the last access date and time
  Console.WriteLine(System.IO.File.GetLastAccessTime(Path));

  // Now delete this file
  System.IO.File.Delete(Path);

  Console.Readline;
end.
   23/09/2004 10:51:49
   01/01/2000 00:00:00
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author