D
d_darkie07
Hi,
I'm a newbie to VB.NET and I'm having some difficulty in viewing the
file creation time. Most links I have read do not seem to have any
problem with viewing such information, but all I get is a date in the
year 1601??!!
I want to see the localtime as I would when I sue sysdate()
Here's the code that I'm using:
------------------
Imports System.IO.File
....
Dim FileProperties As System.IO.Fileinfo(filepath)
Dim FileDate As String
FileDate =
DateTime.FromFileTime(FileProperties.CreationTime.ToFileTime).ToLocalTime.ToLongDateString
--------------
This gives me the date as "01/01/1601 11:00 AM"
I have seen someone doing it much simpler with:
--------------
Dim fileName As String = "C:\Download\readme.txt"
Dim fileData As String
Dim fileDetails As System.IO.FileInfo = New
System.IO.FileInfo(fileName)
With fileDetails
fileData = "File was created at: " & _
.CreationTime.ToShortDateString
End With
-------------
....and apparently that was sufficinet. This doesn;t work for me either.
Any help would be much appreciated.
Thanks,
Darkie
I'm a newbie to VB.NET and I'm having some difficulty in viewing the
file creation time. Most links I have read do not seem to have any
problem with viewing such information, but all I get is a date in the
year 1601??!!
I want to see the localtime as I would when I sue sysdate()
Here's the code that I'm using:
------------------
Imports System.IO.File
....
Dim FileProperties As System.IO.Fileinfo(filepath)
Dim FileDate As String
FileDate =
DateTime.FromFileTime(FileProperties.CreationTime.ToFileTime).ToLocalTime.ToLongDateString
--------------
This gives me the date as "01/01/1601 11:00 AM"
I have seen someone doing it much simpler with:
--------------
Dim fileName As String = "C:\Download\readme.txt"
Dim fileData As String
Dim fileDetails As System.IO.FileInfo = New
System.IO.FileInfo(fileName)
With fileDetails
fileData = "File was created at: " & _
.CreationTime.ToShortDateString
End With
-------------
....and apparently that was sufficinet. This doesn;t work for me either.
Any help would be much appreciated.
Thanks,
Darkie