C# Directory SetLastWriteTimeUtc

Description

Directory SetLastWriteTimeUtc Sets the date and time, in Coordinated Universal Time (UTC) format, that a directory was last written to.

Syntax

Directory.SetLastWriteTimeUtc has the following syntax.


public static void SetLastWriteTimeUtc(
  string path,
  DateTime lastWriteTimeUtc
)

Parameters

Directory.SetLastWriteTimeUtc has the following parameters.

  • path - The path of the directory.
  • lastWriteTimeUtc - The date and time the directory was last written to. This value is expressed in UTC time.

Returns

Directory.SetLastWriteTimeUtc method returns

Example

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


//from   ww w  .  j a v a2 s.c o m
using System;
using System.IO;

public class DirectoryUTCTime
{
  public static void Main()
  {
    string n = @"C:\test\newdir";
    DateTime dtime1 = new DateTime(2014, 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