C# File SetCreationTime

Description

File SetCreationTime Sets the date and time the file was created.

Syntax

File.SetCreationTime has the following syntax.


public static void SetCreationTime(
  string path,
  DateTime creationTime
)

Parameters

File.SetCreationTime has the following parameters.

  • path - The file for which to set the creation date and time information.
  • creationTime - A DateTime containing the value to set for the creation date and time of path. This value is expressed in local time.

Returns

File.SetCreationTime method returns

Example

The following example demonstrates SetCreationTime.


//from  ww  w  .ja v a  2  s. c  om

using System;
using System.IO;

class Test 
{
    public static void Main() 
    {
      string path = @"c:\Temp\MyTest.txt";
      File.SetCreationTime(path, new DateTime(2014,4,3));
    }
}




















Home »
  C# Tutorial »
    System.IO »




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