C# Directory SetCreationTimeUtc

Description

Directory SetCreationTimeUtc Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file or directory.

Syntax

Directory.SetCreationTimeUtc has the following syntax.


public static void SetCreationTimeUtc(
  string path,
  DateTime creationTimeUtc
)

Parameters

Directory.SetCreationTimeUtc has the following parameters.

  • path - The file or directory for which to set the creation date and time information.
  • creationTimeUtc - An object that contains the value to set for the creation date and time of path. This value is expressed in UTC time.

Returns

Directory.SetCreationTimeUtc method returns

Example

Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file or directory.


using System;/*from  ww  w.j  av  a2s . c om*/
using System.IO;

public class DirectoryUTCTime
{
  public static void Main()
  {
     string n = @"C:\test\newdir";
     DateTime dtime1 = new DateTime(2014, 1, 3);
    
     Directory.SetCreationTimeUtc(n, dtime1);
  }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter