Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculate days to advance and skip weekend
Message
 
 
À
06/12/2017 15:41:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01656173
Message ID:
01656176
Vues:
50
Thank you.

>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
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform