Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Figuring out weekdays
Message
 
To
14/06/1999 10:30:34
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00229423
Message ID:
00229426
Views:
20
>Can anyone tell me an easy way to take out weekends when counting days
>Thanks
Hi James,

This is an old function (it's still in FPW format) that calculates business days
* FUNCTION: Bus_Days.prg
* AUTHOR: George Tasker
* DATE: July 30, 1996 - 4:53 PM
* PURPOSE: Returns the number of business days
* between two dates

PARAMETERS p_start, p_stop

PRIVATE m.days, m.stop, m.num_weeks
m.days = (p_stop - p_start) + 1
m.num_weeks = INT(m.days / 7)
m.result = m.num_weeks * 5
m.add_days = m.days % 7
m.stop = p_stop - m.add_days
DO WHILE m.stop < p_stop
  m.stop = m.stop + 1
  IF NOT INLIST(DOW(m.stop), 1, 7)
    m.result = m.result + 1
  ENDIF
ENDDO
RETURN m.result
hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform