C# Directory SetCreationTime
Description
Directory SetCreationTime
Sets the creation date and
time for the specified file or directory.
Syntax
Directory.SetCreationTime
has the following syntax.
public static void SetCreationTime(
string path,
DateTime creationTime
)
Parameters
Directory.SetCreationTime
has the following parameters.
path
- The file or directory for which to set the creation date and time information.creationTime
- An object that contains the value to set for the creation date and time of path. This value is expressed in local time.
Returns
Directory.SetCreationTime
method returns
Example
Sets the creation date and time for the specified file or directory.
using System;/* w ww .j av a 2 s . c o m*/
using System.IO;
public class DirectoryUTCTime
{
public static void Main()
{
string n = @"C:\test\newdir";
DateTime dtime1 = new DateTime(2014, 1, 3);
Directory.SetCreationTime(n, dtime1);
}
}