I need to subtract with dates, but taking into account weekends and holidays.
Kodular has a function for that?
You mean something like - 14 days = 10 business days? (starting today)
You can design yourself using procedure or logic
Yes. I want that calc.
How do I identify if a day is saturday or sunday?
Check up in clock, there is block weekday name. You can use that
By using it in if else block along with equal or not you can achieve that
Eg.
If call clock week day -instant - click now = Sunday
Or
… Saturday
And you can set remaining thing in the then …
Got it ??
Create a database with your holidays.
and create a routine to supply these holidays
Create a database of your holidays as Rogerio said…
Now when you get a range of dates - for example 8th July to 20th July. (13 normal days)
Set two global variables say Business_days to 13
and Start to 7
Run a for each number loop by 1, till global Business_days
Each time, get the day’s name of the date global Start + get number
If the day is a saturday or sunday, set global Business_days to global Business_days - 1
After this loop, get the number of holidays between the given range and subtract it from global Business_days
.
This is just a base, you’ll have to implement it in a more better way to handle all circumstances, such as multiple months’ range
I got it.
Check my solution.
The example cheks saturdays and sundays in 20 days interval from a initial date.
Or you can try this
But with this extension I cannot check holidays days, only I can check weekdays.
See you have tried a method and got working. Fine, in that method itself just combine the the procedure what boban is advised.
Create a holidays list in database like firebase or ghseet or mysql or smoewher. While screen initialise just call the days in the list, if the list days present in the above loop(what you have tried) just add or subtract that too with counter. Simple
This suggestion is practical, flexible and used in Clipper 5.0.(1992)
In your admin app, create this routine to add holidays.
Make this routine can add the same holidays N years (since they usually only change the year-month and day are constant)