FileSystem.FileDateTime(String) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- PathName
- String
Required. A string expression that specifies a file name. PathName
may include the directory or folder, and the drive.
Date
value that indicates the date and time a file was created or last modified.
PathName
is invalid or contains wildcards.
Target file does not exist.
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")
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: