Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
13 ratings:
 3.46 out of 5   

Determining the Date and Time a File Was Created



Primary Software:
Primary Software Version: 8.0
Primary Software Fixed Version: 2012
Secondary Software: N/A

Problem:
The File/Directory Info function only returns the last modified date of a file. How can I find out when a file was created?

Solution:
In order to get the date a file was created, along with other file attributes, you must call the GetFileAttributesEx function in KERNEL32.dll. This function returns the creation date as two 32-bit numbers. You can then use the FileTimeToSystemTime function (also in KERNEL32.dll) to convert the two 32-bit integers to meaningful date/time info.

See the attached VI (LabVIEW 8.0) for an example.

Related Links:
MSDN - GetFileAttributesEx Function Information
MSDN - FileTimeToSystemTime Function Information

Attachments:
GetFileCreationDate.vi




Report Date: 02/07/2007
Last Updated: 04/19/2016
Document ID: 466JBR90

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit