DateDiff(h, date1, date2) should do the trick The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
Sorry, should have also stated that I am working with long date formats, including time. eg. Wednesday August 28, 2002 6:14pm. DateDiff doesn't seem to work when the time is included.
DateDiff should work with long dates... Try using IsDate to verify that the date is being passed correctly.
Code:
If Not IsDate(dtNow) Then
MsgBox "dtNow: " & dtNow & " is not a valid date."
End If
If Not IsDate(dtThen) Then
MsgBox "dtThen: " & dtThen & " is not a valid date."
End If
lElapsed = DateDiff(h, dtThen, dtNow)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.