FileDateTime Function

See AlsoYM74HN              Example3UXG0L3>Low

Returns a String that indicates the date and time a specified file was created or last modified.

Syntax

FileDateTime (filename)

Remarks

The argument filename can be any string expression1330R89 that contains an unambiguous (no wildcards) file specification.  The file specification may include optional drive and path information.


See Also

FileLen Function3DE6YD9

GetAttr FunctionZIM94C


FileDateTime Function Example

The example uses FileDateTime to get date and time information about when a file was created or last modified.  File date and time information is displayed in a message box anytime you choose the name of a file in the file list box.  To try this example, paste the code into the Declarations section of a form containing a file list box named File1.  Then press F5 to start.

Sub File1_Click ()

   Dim Msg, TimeStamp                    ' Declare variables.

   FName = File1.FileName                ' Get selected file name.

   TimeStamp = FileDateTime(FName)       ' Get file date/time info.

   Msg = UCase(FName) & " was created or last modified on "

   Msg = Msg & Format(TimeStamp, "dddddd") & " at "

   Msg = Msg & Format(TimeStamp, "h:mm AM/PM") & ".  Its size is "

   Msg = Msg & FileLen(FName) & " bytes."      ' Get file size.

   MsgBox Msg                            ' Display message.

End Sub