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

Count of Business Days vs Calendar Days

Status
Not open for further replies.

Drucifer1968

IS-IT--Management
Aug 18, 2003
3
US
I'm sure I'm missing something simple - my original formula is below, but it only removes Saturday and Sunday from the count if they are the start or end dates of the report. How can I evaluate all dates between d1 and d2 and remove all Sat and Sun?

----------------
Global DateTimevar d1;
Global DateTimevar d2;
Global Numbervar businessdays;
//--------------------------------------
d1 := {?Start Date};
d2 := {?End Date};
businessdays := (datediff("d", d1,d2) - (datediff ("ww", d1,d2, crsaturday)- datediff ("ww", d1,d2,crSunday)));

if dayofweek(d1) = 7 then businessdays-1;
if dayofweek(d1) = 1 then businessdays-1;

businessdays
 
There are several notes about business days in the Crystal knowledgebase. Check them out.

I think a for next loop would be needed.

Howard Hammerman,
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
Drucifer1968,

see my formula in the following thread.

Thread149-651511

Reebo
UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top