>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)
IF lnDayOfWeek <> 1 AND lnDayOfWeek <> 7
lnWorkDays = lnWorkDays + 1
ENDIF
ENDFOR
? lnWorkDays