find the creation date of a csv file in csharp

To find the creation date of a CSV file in C#, you can use the File.GetCreationTime() method. Here's a sample code block:

main.cs
string fileName = "file.csv";
DateTime creationTime = File.GetCreationTime(fileName);

Console.WriteLine("File created on : " + creationTime.ToString("dd/MM/yyyy HH:mm:ss"));
175 chars
5 lines

In the example above, we're passing the file name "file.csv" to the File.GetCreationTime() method, which returns a DateTime object representing the creation time of the specified file.

Then, we're using the ToString() method with a format string ("dd/MM/yyyy HH:mm:ss") to display the creation date and time in a specific format.

You can replace "file.csv" with any other file name/path you want to get the creation date for.

gistlibby LogSnag