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!

If you know date functions, please read...

Status
Not open for further replies.

Crevalle

Technical User
Aug 16, 2004
36
0
0
US
I have to find the number of weekdays between two dates (to the second decimal). For example, if a ticket is opened at 3pm on Friday, and closed at 4pm on Tuesday, I want to exclude the weekend in the day count and have a result similar to 2.04 days.

I WAS using this formula (which includes the weekend): CLng(([DATE_Max]-[DATE_Min])*100)/100

Then I tried this (to exclude the weekdays) to no avail: DateDiff("w",[DATE_Max],[DATE_Min])

Any ideas? FWIW, the dates are in the following format: "08/09/2004 11:14 PM"

Thanks!
 
FAQ181-261 has a module to calculate the number of working days.

Leslie
 
but it only returns the # WHOLE days. Additional work needs to be done to get the fractional part and even morfe to convert to the decimal hours. Somewhere in these fora there IS a thread which gets to at least the time in Hrs, and Mins. Look for a routine "basWorkHours" for most of the rest. Be SURE to look over the thread(s) carefully, as there are a couple of 'helper' routines which break down the state and end days to the time start / finish.





MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top