FileDateTime Function

   
FileDateTime Function

Class

Microsoft.VisualBasic.FileSystem

Syntax

 FileDateTime(   pathname   ) 
pathname (required; String)

The filename, along with an optional drive and path

Return Value

A Date containing the date and time at which the specified file was created or last modified (whichever is later)

Description

Obtains the date and time at which a particular file was created or last modified (whichever is later)

Rules at a Glance

If you don't specify a drive or folder with pathname , the file is assumed to be in the current drive or folder.

Programming Tips and Gotchas

  • Use the File.Exists method (in the System.IO namespace) to determine that the file exists before calling FileDateTime . If pathname does not exist, your application generates runtime error 53, "File not found."

  • If a file has not been modified, its creation date and last modified date will be identical. However, if the file has been modified since its creation, the FileDateTime function returns only the last modified date. To obtain the file's creation date, you have to resort to using the Window's API. The GetFileTime API call returns not only the date last modified, but the file's creation date and last access date as well.

  • You can also use FileDateTime on hidden files.

See Also

File.Exists Method

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net