Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need assistance with a date-related algorithm
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
00989784
Message ID:
00989787
Views:
30
>I was wondering if someone would know of a reliable algorithm to count the number of Saturdays and the number of Sundays between 2 dates (inclusively)...?
>
>Laterness,
>Jon
FUNCTION CountWeekEnd(dData1, dData2)

  LOCAL ret_val
  DO WHILE dData1 <= dData2
     IF INLIST(DOW(dData1,1),1, 7)
        ret_val = ret_val + 1
     ENDIF
     dData1 = dData1 + 1
  ENDDO

RETURN ret_val
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform