FileDateTime Function
Returns a Date value that indicates the date and time a file was created or last modified.
The My feature gives you greater productivity and performance in file I/O operations than FileDateTime. For more information, see My.Computer.FileSystem.GetFileInfo Method.
Public Function FileDateTime(ByVal PathName As String) As DateTime
Parameters
- PathName
Required. String expression that specifies a file name. PathName may include the directory or folder, and the drive.
Exceptions
Exception type | Error number | Condition |
---|---|---|
PathName is invalid or contains wildcards. |
||
Target file does not exist. |
See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the Number Property (Err Object).) However, when possible, you should consider replacing such error control with Structured Exception Handling Overview for Visual Basic.
Remarks
This function returns a Date value that indicates the date and time a file was created or last modified.
Example
This example uses the FileDateTime function to determine the date and time a file was created or last modified. The format of the date and time displayed is based on the locale settings of your system.
Dim MyStamp As Date
' Assume TESTFILE was last modified on October 12, 2001 at 4:35:47 PM.
' Assume English/U.S. locale settings.
' Returns "10/12/2001 4:35:47 PM".
MyStamp = FileDateTime("C:\TESTFILE.txt")
Smart Device Developer Notes
This function is not supported.
Requirements
Namespace: Microsoft.VisualBasic
Module: FileSystem
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
See Also
Reference
FileLen Function
GetAttr Function
ArgumentException Class
FileNotFoundException Class