Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata