Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate days to advance and skip weekend
Message
From
06/12/2017 15:41:21
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01656173
Message ID:
01656175
Views:
59
here is the equivalent of moment.js in C#: https://github.com/Eonasdan/MomentSharp

>Hi,
>
>I am writing the code in C# but if I know how to do it in VFP, I can easily convert it to C#. That is, I know C# but weak in math :). And I can do this with a bunch of IF CASE and so on. But I think there should be a more concise formula.
>
>nTodayDow - today/current day Day of the week (1 to 7)
>nDays2Advance - variable that holds the number of days to advance, from the current day. This can be 1 to any reasonable number (e.g. 100). And I want to change the nDays2Advance given that the weekend should be skipped (Saturday and Sunday).
>Example:
>nTodayDow = 3 (Wednesday)
>nDays2Advance = 2
>So the nDays2Advance = 2 (since the weekend is too far ahead)
>But if nDays2Advance is 4, then it should be changed to 6, otherwise it will fall on the weekend.
>
>How can I express the above in the formula that would help me calculate nDays2Advance?
>
>TIA
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/
Never explain, never complain (Queen Elizabeth II)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform