Export (0) Print
Expand All

FileDateTime Function

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

Public Function FileDateTime(ByVal PathName As String) As DateTime

Parameter

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

Exceptions/Errors

Exception type Error number Condition
ArgumentException 52 PathName is invalid or contains wildcards.
FileNotFoundException 53 Target file does not exist.

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: Microsoft Visual Basic .NET Runtime (in MicrosoftVisualBasic.dll)

See Also

FileLen Function | GetAttr Function | ArgumentException Class | FileNotFoundException Class

Show:
© 2014 Microsoft