C# File GetCreationTimeUtc

Description

File GetCreationTimeUtc Returns the creation date and time, in coordinated universal time (UTC), of the specified file or directory.

Syntax

File.GetCreationTimeUtc has the following syntax.


public static DateTime GetCreationTimeUtc(
  string path
)

Parameters

File.GetCreationTimeUtc has the following parameters.

  • path - The file or directory for which to obtain creation date and time information.

Returns

File.GetCreationTimeUtc method returns A DateTime structure set to the creation date and time for the specified file or directory. This value is expressed in UTC time.

Example

The following example demonstrates the GetCreationTimeUtc method.


/* www.ja  v a  2  s. c om*/
using System;
using System.IO;


class Program
{
  static void Main(string[] args)
  {
    DateTime fileCreatedDate = File.GetCreationTimeUtc(@"C:\Example\MyTest.txt");
    Console.WriteLine("file created: " + fileCreatedDate);
  }
}

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