Get the time and date when the file was generated in VB

hi, experts, is there a way how to get the time and date of file when it was generated using VB6
jacristobalAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ryan ChongConnect With a Mentor Commented:
Also :

Obtaining and Changing a File's Created, Accessed and Modified Dates
http://vbnet.mvps.org/code/fileapi/filedatetime.htm

Where this using APIs and without using FSO component
0
 
[ fanpages ]IT Services ConsultantCommented:
Hi,

Please replace "filename.ext" with your chosen file, and remove the removes to "datLast_Accessed" and "datLast_Modified" if you are just interested in the "datCreated"...

  Dim datCreated                              As Date
  Dim datLast_Accessed                              As Date
  Dim datLast_Modified                              As Date

  Dim objFSO                                            As Object
  Dim objFSO_GetFile                                    As Object

  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFSO_GetFile = objFSO.GetFile("filename.ext")
 
  datCreated = objFSO_GetFile.DateCreated
  datLast_Accessed = objFSO_GetFile.DateLastAccessed
  datLast_Modified = objFSO_GetFile.DateLastModified
 
  Set objFSO_GetFile = Nothing
  Set objFSO = Nothing
 
BFN,

fp.
0
 
jacristobalAuthor Commented:
tnx fp, it works
0
 
[ fanpages ]IT Services ConsultantCommented:
Hello jacristobal,

Was there a specific reason why you did not wish to use my proposal even though you replied to say "it works"?
0
 
[ fanpages ]IT Services ConsultantCommented:
Hello jacristobal,

Was there a specific reason why you did not wish to use my proposal even though you replied to say "it works"?
0
All Courses

From novice to tech pro — start learning today.