Export (0) Print
Expand All

FileSystem.FileDateTime Method

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

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static DateTime FileDateTime(
	string PathName
)

Parameters

PathName
Type: System.String

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

Return Value

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

ExceptionCondition
ArgumentException

PathName is invalid or contains wildcards.

FileNotFoundException

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft