This C# Program Gets File Time using File Class. Here the File creation time is found using the date time class.
Here is source code of the C# Program to Get File Time using File Class. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/*
* C# Program to Get File Time using File Class
*/
using System;
using System.IO;
class Program
{
static void Main()
{
FileInfo info = new FileInfo("C:\\srip.txt");
DateTime time = info.CreationTime;
Console.WriteLine("File was Created at : ");
Console.Write(time);
Console.Read();
}
}
Here is the output of the C# Program:
File was Created at : 9/30/2013 12:15:44 PM
Sanfoundry Global Education & Learning Series – 1000 C# Programs.
advertisement
advertisement
If you wish to look at all C# Programming examples, go to 1000 C# Programs.
If you find any mistake above, kindly email to [email protected]Related Posts:
- Check C# Books
- Check Computer Science Books
- Practice Computer Science MCQs
- Practice MCA MCQs
- Apply for Computer Science Internship