FileDateTime

Returns a Variant (Date) indicating the date and time when a file was created or last modified.

Syntax: FileDateTime( pathname )

pathname
required String expression that specifies a file name. The pathname may include the directory or folder, and the drive.

Common Errors

Error When
-2147467259 (&H80004005), Unspecified error no file or folder has the name pathname, which includes a zero-length string, a folder named with a backslash at its end, and a name with a character a name cannot hold
the folder or drive named in pathname does not exist
pathname holds a wildcard that matches no file or folder
94 (&H5E), Invalid use of Null pathname is Null

Note BETA 1034

When no file or folder has the name pathname, which includes a zero-length string, a folder named with a backslash at its end, and a name with a character a name cannot hold, VB6 and 64-bit VBA raise error 53 (&H35), File not found, instead.

Note BETA 1034

When the folder or drive named in pathname does not exist, VB6 and 64-bit VBA raise error 76 (&H4C), Path not found, instead.

Note BETA 1034

When pathname holds a wildcard that matches no file or folder, VB6 and 64-bit VBA raise error 52 (&H34), Bad file name or number, instead.

Note BETA 1034

When pathname holds a wildcard that matches a file or folder, VB6 and 64-bit VBA raise error 52 (&H34), Bad file name or number; twinBASIC raises none.

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 system’s locale settings.

Dim MyStamp
' Assume TESTFILE was last modified on February 12, 1993 at 4:35:47 PM.
' Assume English/U.S. locale settings.
MyStamp = FileDateTime("TESTFILE")    ' Returns "2/12/93 4:35:47 PM".

See Also