FileDateTime Function |
No
FileDateTime(pathname)
pathname
Use: Required
Data Type: String
The filename, along with an optional drive and path.
A Variant of subtype Date containing the date and time that the specified file was last modified.
Obtains the date and time a particular file was last modified.
If you don't specify a drive or folder with filename, the file is assumed to be in the current drive or folder.
Use the Dir function to determine that the file exists before calling File-DateTime. If filename doesn't exist, your application generates runtime error 53, "File not found."
FileDateTime is a read-only: you can retrieve, but you can't set, the file's date and time property.
If a file has not been modified, its creation date and last modified date are identical. However, if the file has been modified since its creation, the File-DateTime function returns only the date last modified. To obtain the file's creation date, you must use the Window's API. The GetFileTime API call returns not only the date last modified, but the file's creation date and last access date as well.
You can also use FileDateTime on hidden files.
The File System object model in VB6 allows you to reference a file using the File object. You can use it to obtain the date a file was created, last accessed, and last modified.