Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculate days to advance and skip weekend
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01656173
Message ID:
01656184
Vues:
54
>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

I think another way of creating a solution to my question (above) is being able to calculate how many Saturdays or Sundays fall between two dates. If I could get this, I think I would find the solution.
"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