Reader Level:
ARTICLE

Get File Creation Time in C#

On August 09, 2012 Articles | Files, Directory, IO
In this article we will discuss about how to Get File Creation Time in C#.
  • 0
  • 0
  • 11129

The SetLastAccessTime and GetLastAccessTime methods are used to set and get the last access date and time of the specified file. The following code snippet sets and gets the last access date and time of a file.

// Get and set file last access time
string
fileName = @"c:\temp\Mahesh.txt";
File
.SetLastAccessTime(fileName, DateTime.Now);
DateTime
dt = File.GetLastAccessTime(fileName);
Console
.WriteLine("File last access time: {0}", dt.ToString());

 

Dinesh Beniwal

 I am working as VP Content Manager, responsible for content publishing, content development, and social relation. You can follow me on twitter @dbeniwal21

  • 4rank
  • 4M readers
COMMENT USING

Trending up