ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Testing Time /Date stamps of Files (https://www.excelbanter.com/excel-programming/275761-re-testing-time-date-stamps-files.html)

Tom Ogilvy

Testing Time /Date stamps of Files
 
I assumed you were correct, but on further reflection, according to help:

Returns a Variant (Date) that indicates the date and time when a file was
created or last modified.

from the immediate window:

? typename(filedatetime("c:\testfile.txt"))
Date


--
Regards,
Tom Ogilvy


Hotbird wrote in message
...
I want to update a file on the C: drive, only if a later version can be
found on the A: drive. I have searched the VBA Help files, and the only
method I can see returns a text string date/time stamp that would be
difficult to use in a comparison. Is there a better way, that will return
the date/time stamp in numeric form?

Dim MyStamp
' Assume TESTFILE was last modified on February 12, 1993 at 4:35:47 PM.
' Assume English/U.S. locale settings.
MyStamp = FileDateTime("TESTFILE") ' Returns "2/12/93 4:35:47 PM".






Hotbird

Testing Time /Date stamps of Files
 
Thank you for these ideas Tom. I now have 2 avenues to follow up.

? cdate("2/12/93 4:35:47 PM")
2/12/93 4:35:47 PM
vDt = cdate("2/12/93 4:35:47 PM")
? hour(vDt),minute(vDt),second(vDt) & vbNewLine &
year(vDt),month(vDt),Day(vdt)
16 35 47
1993 2 12

"Tom Ogilvy" wrote in message
? typename(filedatetime("c:\testfile.txt"))
Date





All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com