|View script||License||Download documentation as: HTML or editable|
|Download script||History||Other scripts by: sunanda|
Script Library: 1223 scripts
Documentation for: work-days.r
Author: Sunanda Version: 1.0 Date: 18-feb-2007
1. calculate working days
This script calculates the number of working days between two dates.
do %work-days.r calc-work-days now now + 7  == 5 ;; working weeks have five working days calc-work-days 1-jan-2008 5-jan-2008  == 3 ;; tue to sat is three working days (wed, thu, fri) calc-work-days/non 1-jan-2008 5-jan-2008  == 1 ;; tue to sat is one non-working day (sat)
3.1. starting the script
There is just one function with one optional refinement:
3.2.1. calc-work-days start, end, holidays
3.3. /non refinement
"inverts" the output -- ie output is number of non-working days in the range.
4. definitions / specification
5. acknowledgements / credits
This script was written in response to a challenge on the REBOL Mailing List to produce a better script.
Thanks to Ed O'Conner for providing that initial impetus.
His challenge came from seeing a RUBY version of the script. It is instructive to compare all the approaches used.
Last updated: 18-Feb-2007