C# File GetLastAccessTimeUtc

Description

File GetLastAccessTimeUtc Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.

Syntax

File.GetLastAccessTimeUtc has the following syntax.


public static DateTime GetLastAccessTimeUtc(
  string path
)

Parameters

File.GetLastAccessTimeUtc has the following parameters.

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

Returns

File.GetLastAccessTimeUtc method returns A DateTime structure set to the date and time that the specified file or directory was last accessed. This value is expressed in UTC time.

Example

The following example demonstrates the GetLastAccessTimeUtc method.


// w  w w .j a  v a 2  s  . co  m
using System;
using System.IO;


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

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