Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add Work days to a date
Message
From
02/04/2007 12:31:31
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
 
To
02/04/2007 11:46:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01211326
Message ID:
01211351
Views:
15
Thanks Edward,

This is close but but it uses Tuesday through Saturday. Here is my test code.
CLEAR 
d1={^2007-04-03}

FOR lnx = 1 TO 20 
 ?AddWorkDays(d1,lnx)
NEXT 

FUNCTION AddWorkDays(startDate,nAdddaysnumber)
  	LOCAL nDay[2]
		ldDate = (Startdate+7*floor(nAdddaysnumber/5))+MOD(nAdddaysnumber,5)
		return TRANSFORM(ldDate)+" "+CDOW(ldDate)
ENDFUNC 
>>Hi All
>>
>>Anyone have a good program to add the number of workdays to a date without looping through the dates? I am not worried about holidays and such. Just Monday through Friday.
>>
>>Thanks.
>
>Something like this:
>
>Function addworkdays
>Lparameters dStartdate,nAdddaysnumber
>Return dStartdate+7*floor(nAdddaysnumber/5)+MOD(nAdddaysnumber,5)
>
Previous
Reply
Map
View

Click here to load this message in the networking platform