Imports System
Imports System.IO
Public Class DirectoryUTCTime
Public Shared Sub Main()
Dim n As String = "C:\test\newdir"
Dim dtime1 As New DateTime(2010, 1, 3)
Dim dtime2 As New DateTime(1999, 1, 1)
Try
Directory.CreateDirectory(n)
Catch e As IOException
Console.WriteLine(e)
End Try
Directory.SetCreationTime(n, dtime1)
Directory.SetLastAccessTimeUtc(n, dtime1)
Console.WriteLine("Creation Date: {0}", Directory.GetCreationTime(n))
Console.WriteLine("UTC creation Date: {0}", Directory.GetCreationTimeUtc(n))
Console.WriteLine("Last write time: {0}", Directory.GetLastWriteTime(n))
Console.WriteLine("UTC last write time: {0}", Directory.GetLastWriteTimeUtc(n))
Console.WriteLine("Last access time: {0}", Directory.GetLastAccessTime(n))
Console.WriteLine("UTC last access time: {0}", Directory.GetLastAccessTimeUtc(n))
Directory.SetLastWriteTimeUtc(n, dtime2)
Console.WriteLine("Changed last write time: {0}", Directory.GetLastWriteTimeUtc(n))
End Sub
End Class