Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculate working days
Message
 
À
05/02/2002 21:41:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00615849
Message ID:
00615851
Vues:
21
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform