FileDateTime 函数FileDateTime function

返回指示文件创建或最后修改的 Variant (Date)。Returns a Variant (Date) that indicates the date and time when a file was created or last modified.

语法Syntax

FileDateTime(pathname)FileDateTime(pathname)

必需的_pathname_ 参数是指定文件名的字符串表达式The required pathname argument is a string expression that specifies a file name. pathname 可能包括目录或文件夹,以及驱动器。The pathname may include the directory or folder, and the drive.

示例Example

本示例使用 FileDateTime 函数来确定文件的创建或最后修改日期。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".


另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.