Rediger

Del via


FileSystem.FileDateTime(String) Method

Definition

Returns a Date value that indicates the date and time a file was written to. The My feature gives you better productivity and performance in file I/O operations than FileDateTime. For more information, see GetFileInfo(String).

public:
 static DateTime FileDateTime(System::String ^ PathName);
public static DateTime FileDateTime (string PathName);
static member FileDateTime : string -> DateTime
Public Function FileDateTime (PathName As String) As DateTime

Parameters

PathName
String

Required. A string expression that specifies a file name. PathName may include the directory or folder, and the drive.

Returns

Date value that indicates the date and time a file was created or last modified.

Exceptions

PathName is invalid or contains wildcards.

Target file does not exist.

Examples

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

Applies to

See also