How do you obtain the DateTime stamp of a textfile using VB 6.0? By DateTime stamp I mean the date & time the textfile was created or modified. Sample code would be appreciated. Thanks.
+1
A:
Use the GetFile
method in FileSystemObject
and then just use the DateCreated
and 'DateLastModified' properties of it.
Here's the documentation with a sample for how to do it from VBscript (pretty much the same from VB6):
http://msdn.microsoft.com/en-us/library/sheydkke%28VS.85%29.aspx
ho1
2010-05-21 09:20:53
+1
A:
You want the FileSystemObject from the scripting run time.
MS gives an example of getting the creation time
Note that example works in VBScript as well in VB6 you can get the file by http://msdn.microsoft.com/en-us/library/aa716288(VS.60).aspx
ie
Dim fso As New FileSystemObject, fil As File
Set fil = fso.GetFile("c:\test.txt")
Mark
2010-05-21 09:21:09
+3
A:
For created/last modified you can simply;
dateVar = FileDateTime("c:\foo\bar\qux.file")
Alex K.
2010-05-21 10:00:10
This works and is simpler than using the FileSystemObject from the scripting run time. Thanks Alex
Jack Njiri
2010-05-21 12:06:30
Nice. I was not aware that function existed.
raven
2010-05-21 12:34:34