I need to calculate the number of days between a start date and an end date but I only want weekdays included. I need some code that will take out the weekends.
Hi,
Recently I had to do similar thing but in Visual FoxPro so I got this function that you call with your start and end date
** Date1,Date2 are arguments to this function**
ldStartDate= IIF(Date1> Date2,Date2,Date1)
ldEndinDate = IIF(Date1=> Date2,Date1,Date2)
lnNumberOfDays = ldEndinDate - ldStartDate
lnReturnDays = lnNumberOfDays
FOR iDays = 1 TO lnNumberOfDays
IF DOW(ldStartDate + iDays) < 7 AND ;
DOW(ldStartDate + iDays) > 1
lnReturnDays = lnReturnDays
ELSE
lnReturnDays = lnReturnDays - 1
ENDIF
ENDFOR
It often starts with this. It usually esclates to exclude Holidays after a REALLY short interval (the fisrt HOLIDAY period).
look at faq181-261
It shows how to do it all. If you want to wait for the 'User Community' to whine, snivel and complain about the HOLIDAYS, use the faq soloution anyway. Just make an empty holiday table.
MichaelRed
redmsp@erols.com
There is never time to do it right but there is always time to do it over
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.