Applies ToAccess for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

Note: The function, method, object, or property described in this topic is disabled if the Microsoft Jet Expression Service is running in sandbox mode, which prevents the evaluation of potentially unsafe expressions. For more information on sandbox mode, search for "sandbox mode" in Help.

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

Syntax

FileDateTime ( pathname )

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

Example

Note: Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

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' 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".

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.