C# File SetLastWriteTimeUtc

Description

File SetLastWriteTimeUtc Sets the date and time, in coordinated universal time (UTC), that the specified file was last written to.

Syntax

File.SetLastWriteTimeUtc has the following syntax.


public static void SetLastWriteTimeUtc(
  string path,
  DateTime lastWriteTimeUtc
)

Parameters

File.SetLastWriteTimeUtc has the following parameters.

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

Returns

File.SetLastWriteTimeUtc method returns

Example

The following example demonstrates SetLastWriteTimeUtc.


/*from  www  . ja v  a 2  s  .co  m*/

using System;
using System.IO;

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