File Creation Time : 8/11/2013 7:17:20 PM File Access Time : 8/15/2013 1:08:45 PM File Last Write Time : 8/15/2013 1:37:36 PM
Users Online
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Latest Articles
Articles Hierarchy
C# Program to View the Access Date and Time of a File
C# Program to View the Access Date and Time of a File
This is a C# Program to view the date and time of access of a file.
This C# Program Views the Date and time of Access of a File.
Here the date and time of the file access are obtained using the info class functions.
Here is source code of the C# Program to View the Date and time of Access of a File. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to View the Date and time of Access of a File */ using System; using System.IO; class Program { static void Main() { FileInfo info = new FileInfo("C:\\sri\\srip.txt"); DateTime time = info.CreationTime; Console.WriteLine("File Creation Time : {0}", time); time = info.LastAccessTime; Console.WriteLine("File Last Access Time : {0}", time); time = info.LastWriteTime; Console.WriteLine("File Last Write Time : {0} ", time); Console.Read(); } }
This C# program is used to view the date and time of access of a file. The CreationTime is used to get or set the creation time of the current file or directory. Then LastAccessTime is used to get or set the time of the current file or directory last accessed.
The LastWriteTime is used to get or set the time when the current file or directory was last written to. The date and time of the file access is obtained using the info class functions and print the date and time access of a file.