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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating Elapsed Time

Status
Not open for further replies.

VBANewbie

MIS
Dec 13, 2001
4
GB
Hi

I have two fields: DateOne and DateTwo. Example of typical field data '14/12/2000 14:32:31' and '17/12/2000 10:05:01'. What I need to do is calculate the time elapsed since date one and date two in hours. I can easily calculate the number of hours using only 14/12/2000 and 17/12/2000 but when I try and compare the date and time together (which is what I need) I cant do it!

Please can someone help as its driving me nuts!!

Example.

13/12/2001 14:00:00 compared with 13/12/2001 15:00:00
would return: 1 hour.

12/12/2001 14:00:00 compared with 13/12/2001 16:00:00 would return: 26 hours.
 


try =DateDiff("h",[Date1],[Date2])

make sure the output field is formatted as General Number and not a date
 
Agreed.

I have built sveeral Stop Clocks (to calculate working hours from the difference between two date/time groups actual hours)

It works.
 
Hi

Thanks for that. I've had a look at DateDiff before. The only problem is it needs to only count working weekdays (ie Monday to Friday).

Have you guys done this before?

Date diff is great for returning the number of minutes between to date/times but how do I tell it to ignore Saturdays/ Sundays?
 
see the FABOULOUS faq181-261 It (as I recall) only does the (TRUE!) working days, so you would need to do the partial days seperatly, or modify the function (to make a "basWorkingHours"?) and decide which hours of the specific "working days" were working hours ...

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top