C# Directory GetCreationTime

Description

Directory GetCreationTime Gets the creation date and time of a directory.

Syntax

Directory.GetCreationTime has the following syntax.


public static DateTime GetCreationTime(
  string path
)

Parameters

Directory.GetCreationTime has the following parameters.

  • path - The path of the directory.

Returns

Directory.GetCreationTime method returns A structure that is set to the creation date and time for the specified directory. This value is expressed in local time.

Example

The following example gets the creation time of the specified directory.


/*from   w  w  w.  j  a  v a2  s.  c  om*/
using System;
using System.IO;

class Test 
{
    public static void Main() 
    {
        DateTime dt = Directory.GetCreationTime(Environment.CurrentDirectory);

        Console.WriteLine(dt);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




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