Given a file and a directory and we have to find their last write time in UTC using C# program.
File.GetLastWriteTimeUtc()
This is a method of "File class, it is used to get the last write time in UTC format of given file/directory.
Syntax:
File.GetLastWriteTimeUtc(path);
Parameter(s):
- path - Location of file or directory.
Last write time contains 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.