Here, we have to create a file and print the time, when it is created.
File.GetCreationTime()
This is a method of "File" class, which returns the file creation time.
Syntax:
DateTime GetCreationTime(path);
Parameter(s):
path - Filename with its location.
Return value:
It returns a DateTime object. This 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