| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
Here is a script that I use to compare 2 dates and do something as needed. Const WindowsFolder = 0 Const SystemFolder = 1 Dim fso : Set fso = CreateObject("Scripting.FileSystemObject") Dim WshShell : Set WshShell = CreateObject("WScript.Shell") Dim MyDate MyDate = DateValue("7/17/2002 5:33:00 AM") ' Return a date. If CompareFileDate(fso.GetFile(Fso.GetSpecialFolder(WindowsFolder) & "\help\hschelp.chm"), "7/17/2002 5:33:00 AM") = -1 then Msgbox "nope" Else Msgbox "yup" End if Function CompareFileDate(Version1,Version2) ' Function returns -1 if Version1 < Version2 ' Function returns 1 if Version1 > Version2 ' Function returns 0 if Version1 = Version2 If DateValue(Version1.datelastmodified)<DateValue(Version2) then CompareFileDate = -1 Exit Function ElseIf DateValue(Version1.datelastmodified)>DateValue(Version2) then CompareFileDate = 1 Exit Function Else CompareFileDate = 1 Exit Function End if End Function
|
|