Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate days to advance and skip weekend
Message
From
07/12/2017 03:15:49
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01656173
Message ID:
01656205
Views:
46
Just in case… https://stackoverflow.com/questions/20788411/how-to-exclude-weekends-between-two-dates-using-moment-js

>>>>>
>>>>>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.
>>
>>Hum. I think it's better, now.
>>
>>
>>m.RealDaysToAdvance = m.DaysToAdvance + INT((m.TodayDow + m.DaysToAdvance - 1) / 5) * 2
>>
>>
>>And a small program to give us a visual clue.
>>
>>
>>LOCAL DaysToAdvance AS Integer
>>LOCAL RealDaysToAdvance AS Integer
>>LOCAL Advanced AS Integer
>>LOCAL DisplayDays AS Integer
>>
>>CLEAR
>>
>>LOCAL TodayDow AS Integer
>>
>>m.TodayDow = 1
>>
>>FOR m.DaysToAdvance = 1 TO 20
>>
>>	? m.DaysToAdvance
>>
>>	m.RealDaysToAdvance = m.DaysToAdvance + INT((m.TodayDow + m.DaysToAdvance - 1) / 5) * 2
>>
>>	?? " - >", m.RealDaysToAdvance
>>	? "."
>>
>>	m.Advanced = 0
>>
>>	FOR m.DisplayDays = 1 TO m.RealDaysToAdvance
>>
>>		IF (m.TodayDow + m.DisplayDays) % 7 = 6 OR (m.TodayDow + m.DisplayDays) % 7 = 0
>>			?? "|"
>>		ELSE
>>			?? "+"
>>			m.Advanced = m.Advanced + 1
>>		ENDIF
>>
>>	ENDFOR
>>
>>	?? "", m.Advanced
>>
>>ENDFOR
>>
>
>Thank you very much, Antonio. I will try this code tomorrow.
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
Reply
Map
View

Click here to load this message in the networking platform