[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 132
  • Last Modified:

Read file's date and time

How can I read a file's date and time?
0
chill
Asked:
chill
  • 2
1 Solution
 
smeggheadCommented:
Include a reference to..
'Microsoft Scripting Runtime'

 Dim fso As New FileSystemObject
 Const fn = "c:\fred.txt"
 MsgBox fso.GetFile(fn).DateCreated
 MsgBox fso.GetFile(fn).DateLastModified
 MsgBox fso.GetFile(fn).DateLastAccessed

hth
0
 
VbmasterCommented:
from the VB helpfile

"FileDateTime function

Returns a Variant (Date) that indicates the date and time when a file was created or last modified.

Syntax

FileDateTime(pathname)

The required pathname argument is a string expression that specifies a file name. The pathname may include the directory or folder, and the drive."
0
 
VbmasterCommented:
If you want the LastAccessed and LastModified etc here's a better way to do it then using the Scripting control.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3590
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now