How to get DateTime stamp of a textfile using VB 6

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.

Answer1:

For created/last modified you can simply;

dateVar = FileDateTime("c:\foo\bar\qux.file")

Answer2:

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

Answer3:

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")

Answer4:

How about this:

Dev X : get datetime in VB6

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:How to get DateTime stamp of a textfile using VB 6