How can we get the local file date example chethan.pdf or chethan.txt

hello family,
how can I get the file info like the date?
Can anyone tell me, please

Chethan P


There are 2 ways to achieve it.

  1. Use System.IO.File class. such as System.Io.File.GetLastWriteTime method
  1. Use FileInfo class

for example

fi = new FileInfo("C:\temp\test.txt")

then, fi.LastAccessTime returns last access time


1 Like