Given a file and a directory and we have to find their last write time using C# program.
File.GetLastWriteTime()
This is a method of "File class, it is used to get the last write time of given file/directory.
Syntax:
File.GetLastWriteTime(path);
Parameter(s):
- path - Location of file or directory.
Last write time contains the following detail:
- Date
- Month
- Year
- Hour
- Minute
- Second
- AM/PM
-
Program
Output
Note: In above program, we need to remember, when we use "File" class, System.IO namespace must be included in the program.