subtracting dates

If i have two dates and times - how can i work out the time between them.

ie I would like to know if it has been over 24 hours between 2 specified dates and times.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Look at the DateDiff Function...

Good luck!!
I did not understand your problem but this might help you..

Dim Date1 As Date
Dim Date2 As Date
Dim date3 As Integer

Date1 = "1999/12/25"
Date2 = "2005/01/03"

date3 = DateDiff("d", Date1, Date2)

MsgBox date3

If you want to combine date and time text

datettime = CDate(txtDate & " " & txtTime)
Hmmmmm..... looks like something I might have suggested....<g>
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Hi wormboy_6, try this

Dim date1 As Date
Dim date2 As Date
Dim lSeconds As Long
Dim lHours As Long
Dim lMins As Long
Dim lDays As Long
date1 = CDate("August 29, 1999 12:20:55PM")
date2 = CDate("August 30, 1999 1:54:12PM")
lSeconds = CStr(DateDiff("s", date1, date2))

lDays = lSeconds \ (24& * 3600)
lSeconds = lSeconds - lDays * 24& * 3600
lHours = lSeconds \ 3600
lSeconds = lSeconds - lHours * 3600&
lMins = lSeconds \ 60&
lSeconds = lSeconds - lMins * 60

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You have the right answer, but I think you made it a little more difficult then it had to be.  He/She only needs the hour difference.

Dim TheHourDiff As Integer
Dim date1 As Date
Dim date2 As Date
date1 = CDate("August 29, 1999 12:20:55PM")
date2 = CDate("August 30, 1999 1:54:12PM")
TheHourDiff = DateDiff("h", date1, date2)
wormboy__6Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.