Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate working days
Message
 
 
To
05/02/2002 21:41:14
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00615849
Message ID:
00615851
Views:
20
>In my program I need to cacluate the working days of every month. Does Visual Foxpro provide this function. my region is Hong Kong. please give me some reference. thanks a lot!

This code assumes that working days are Monday to Friday. You can modify if the working days are different. Also, you will need to store vacations or other days off in a day to subtract from this amount. In this sample, I force Sunday to be equal to 1 using the 2nd parameter of the DOW() function.
ldMonthStart = {^2002/01/01} 
ldMonthEnd = {^2002/01/31}
lnWorkDays = 0
FOR i = 0 TO ldMonthEnd - ldMonthStart
	lnDayOfWeek = DOW(ldMonthStart + i,1) && get day of week forcing Sunday to be 1
	IF lnDayOfWeek <> 1 AND lnDayOfWeek <> 7 && not Sunday or Saturday
		lnWorkDays = lnWorkDays + 1		
	ENDIF
ENDFOR
? lnWorkDays
Previous
Reply
Map
View

Click here to load this message in the networking platform