>Hi all,
>
>I'm coding some project metrics using input from a MS Project ASCII export. Cosidering scheduling typically uses only work days (M-F), I need some help coding a routine which will count the number of work days (exlcuding Sat and Sun) between two dates. any assistance would be appreciated...
You could brute-force it with something like this:
FUNCTION WorkDays
LPARAMETERS tdStart, tdEnd
LOCAL lnWorkDays, ldTest
lnWorkDays = 0
ldTest = tdStart
DO WHILE ldTest <= tdEnd
IF DOW(ldTest) > 1 AND DOW(ldTest) < 7
lnWorkDays = lnWorkDays + 1
ENDIF
ldTest = ldTest + 1
ENDDO
RETURN lnWorkDays
This routine could be improved to handle stat holidays by creating a small table of the holiday dates indexed on the date of the holiday. Do an IF SEEK() on this table inside the IF DOW() condition and if the result is .F. then the test date is not a stat.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up