Syntax
|
FileDateTime
(filename$)
|
Description
|
Returns a
Date
variant representing the date and time of the last modification of a file.
|
Comments
|
This function retrieves the date and time of the last modification of the file specified by filename$ (wildcards are not allowed). A runtime error results if the file does not exist. The value returned can be used with the date/time functions (i.e.,
Year
,
Month
,
Day
,
Weekday
,
Minute
,
Second
,
Hour
) to extract the individual elements.
|
Example
|
This example gets the file date/time of the autoexec.bat file and displays it in a dialog box.
Sub Main()
If FileExists("c:\autoexec.bat") Then
a# = FileDateTime("c:\autoexec.bat")
MsgBox "The date/time information for the file is: " & Year(a#) & "-" & Month(a#) & "-" & Day(a#)
Else
MsgBox "The file does not exist."
End If
End Sub
|
See Also
|
FileLen (function); GetAttr (function); FileAttr (function); FileExists (function).
|
Notes:
|
The Win32 operating system stores the file creation date, last modification date, and the date the file was last written to. The
FileDateTime
function only returns the last modification date.
|