Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Testing Time /Date stamps of Files

Just convert the string with cdate

Demoing from the immediate window:

? 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

--
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".





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Testing Time /Date stamps of Files

Have found another way to do this. First, I searched the Google archives
for previous posts about FileDateTime, and many had already asked for an
easy way to convert FileDateTime's text string into a number, which can then
be used in arithmetic formulae. Sadly, I found no answers.

Now I have one which relies upon the DateDiff function. Its first parameter
"s" specifies the required units of difference, in my case seconds, for
maximum precision. Here is a sample from my code which may help others
interested in constructing file timestamp dependent operations.

Dim ATimeStamp as Date
Dim CTimeStamp as Date

File = "Main000.TXT"
ATimeStamp = FileDateTime("A:\" & File)
CTimeStamp = FileDateTime("C:\WeakLink\Series6" & File)

If DateDiff("s", CTimeStamp, ATimeStamp) 0 Then
MsgBox "First Outcome"
Else
MsgBox "Second Outcome"
End If

"Tom Ogilvy" wrote in message
...
Just convert the string with cdate

Demoing from the immediate window:

? 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

--
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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between 2 time stamps Raj Excel Discussion (Misc queries) 5 June 16th 09 02:27 PM
Time Stamps??????????? looper Excel Discussion (Misc queries) 0 March 2nd 07 11:14 PM
I need to find the yy/mm/dd AND hh:mm:ss between 2 time stamps Pontoon Excel Discussion (Misc queries) 5 June 22nd 06 01:23 PM
greater control of date/time stamps on line charts in excel FabricProfile Charts and Charting in Excel 0 October 11th 05 02:40 PM
Difference between two Excel Date/Time Stamps lnapier Excel Worksheet Functions 7 June 30th 05 02:14 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"