Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate days to advance and skip weekend
Message
From
07/12/2017 02:53:40
 
 
To
07/12/2017 00:54:58
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01656173
Message ID:
01656204
Views:
49
>>>>>
>>>>>I will try your approach. Although I don't like it ;) I have been thinking about it all day and you come up with a very simple formula :) Thank you!
>>>>
>>>>Assuming it works ;)
>>>>
>>>>My view? I think that sometimes we have to put some distance to a problem to get it solved. That is, sometimes what helps me is to stop thinking about a problem...
>>>
>>>I agree with you. My best solutions are either in my sleep or while I am taking a walk.
>>
>>And... going back to the code... I smell something funny regarding Saturdays...
>
>And I'm wondering whether the problem is well defined. Why count weekdays only? Shouldn't it be workdays? If we mean business.
>
>Then it's not just weekend days, it's holidays as well. So we better not go with a day-of-week parameter, but a date parameter, and have a list of workdays... a cursor, even better, which would contain all workdays. Then simply locate that date in the list (assuming we aren't starting off a day off) and then just skip n days - and return that record's date. Then we're depending only on the accuracy of this calendar.

I have done some work for this, in case Dmitry is interested, at https://bitbucket.org/atlopes/calendar. Having a method for calculating working days after a specific date seems a very interesting idea.

Of course, I think Dmitry is starting with a Date, it just gets transformed into a weekday for the purpose of the calculation.
----------------------------------
António Tavares Lopes
Previous
Reply
Map
View

Click here to load this message in the networking platform