Given a file, and we have to define (set) a new file creation time using C# program.
File.SetCreationTime()
This is a method of "File" class, which is used to define a new file creation time.
Syntax:
void SetCreationTime(path, DateTime);
Parameter(s):
- path - Filename with its location.
- DateTime - Here we need to pass object of date time class..
Object of DateTime contains following information:
- Month
- Date
- Year
- Hour
- Minutes
- Seconds
- AM and 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.
need an explanation for this answer? contact us directly to get an explanation for this answer