C# Directory SetLastAccessTimeUtc

Description

Directory SetLastAccessTimeUtc Sets the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.

Syntax

Directory.SetLastAccessTimeUtc has the following syntax.


public static void SetLastAccessTimeUtc(
  string path,
  DateTime lastAccessTimeUtc
)

Parameters

Directory.SetLastAccessTimeUtc has the following parameters.

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

Returns

Directory.SetLastAccessTimeUtc method returns

Example

The following example illustrates the differences in output when using Coordinated Universal Time (UTC) output.


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

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

    Directory.SetLastAccessTimeUtc(n, dtime1);
    Console.WriteLine("UTC last access time: {0}", Directory.GetLastAccessTimeUtc(n));
  }
}




















Home »
  C# Tutorial »
    System.IO »




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