Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Elapsed time 1

Status
Not open for further replies.

Terkle

Technical User
Jul 22, 2007
18
0
0
Hi there
I've got two fields on a form 'Arrival Time' and 'Departure Time'. These are set up as Date/Time fields with an input mask for short time. I'm trying to calculate the elapsed time between arrival and departure but a simple query subtracting one from the other doesn't produce any meaningful data. Can anyone advise me how I can do this?

Thanks, as always, for any useful suggestions.

Terk
 
but a simple query subtracting one from the other doesn't produce any meaningful data
Any chance you could post your actual code with actual results and explain us what is expected ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
If you are looking for the number of seconds from one date to another I use this code...

Code:
' Calculate the time taken in seconds.
datCurrTime = Now()
intSeconds = Int(86400 * TimeValue([datCurrTime])) - Int(86400 * TimeValue([datTimeStarted]))
 
Thanks everyone for your help and suggestions. Remou solved it for me first off with his advice to use the DateDiff function. I had tried that but had left [] around the letters instead of replacing them with "". I'd also forgotten I needed to log in to be able to reply and have just realised that so thanks again for all your assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top