Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine how many work days between two dates
Message
From
22/05/2003 12:46:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
22/05/2003 03:05:49
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00791473
Message ID:
00791711
Views:
20
>Hi,
>
>Has anyone had to work this one out before. Either how many work days between 2 dates or how many weekends between the 2 dates.
>
>Regards
>Doug Johnston

Assuming holidays doesn't matter :
lparameters tdD1, tdD2, tnWorkDaysInWeek
* First day of workday is Monday - 2
tnWorkDaysInWeek = iif(empty(tnWorkDaysInWeek),5,tnWorkDaysInWeek)
return floor(abs(tdD2-tdD1)/7) * tnWorkDaysInWeek + ;
  min(dow(max(tdD1,tdD2),2),tnWorkDaysInWeek) - ;
  dow(min(tdD1,tdD2),2) + 1
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform