How can I Display of File Creation Dates
-
Dear Colleagues, Could anyone help me with a code to display next to the files in the File list, the date and time each file was created. I have made a form that uses the Drive, Directory, and FileList Controls to display a list of files that are contained in a chosen directory within a selected drive. All other bits are functioning well, except the part that I have mentioned above. All your contributions will be welcome. Thank you Ben
-
Dear Colleagues, Could anyone help me with a code to display next to the files in the File list, the date and time each file was created. I have made a form that uses the Drive, Directory, and FileList Controls to display a list of files that are contained in a chosen directory within a selected drive. All other bits are functioning well, except the part that I have mentioned above. All your contributions will be welcome. Thank you Ben
use the FileInfo method provided in the system.IO class. copy and paste the following code into a new project, test it out, and edit. edit: oh ya, this is for a console application. Imports System.IO Module Module1 Sub Main() Dim myFileName As String = "C:\file.txt" Dim myFileInfo As New FileInfo(myFileName) 'print time created on 24 hour scale Console.WriteLine( _ myFileInfo.CreationTime.Hour _ & ":" _ & myFileInfo.CreationTime.Minute _ & ":" _ & myFileInfo.CreationTime.Second) 'print the date created in YYYY/M/D form Console.WriteLine( _ myFileInfo.CreationTime.Year _ & "/" _ & myFileInfo.CreationTime.Month _ & "/" _ & myFileInfo.CreationTime.Day) Console.ReadLine() End Sub End Module ------------------------ Jordan. III