C# File SetLastAccessTimeUtc

Description

File SetLastAccessTimeUtc Sets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.

Syntax

File.SetLastAccessTimeUtc has the following syntax.


public static void SetLastAccessTimeUtc(
  string path,
  DateTime lastAccessTimeUtc
)

Parameters

File.SetLastAccessTimeUtc has the following parameters.

  • path - The file for which to set the access date and time information.
  • lastAccessTimeUtc - A DateTime containing the value to set for the last access date and time of path. This value is expressed in UTC time.

Returns

File.SetLastAccessTimeUtc method returns

Example

The following example demonstrates SetLastAccessTimeUtc.


//ww w  . j a  v  a  2  s . c  o  m

using System;
using System.IO;

class Test 
{
    public static void Main() 
    {
      string path = @"c:\Temp\MyTest.txt";
      File.SetLastAccessTimeUtc(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