Documention for: work-days.r
Created by: sunanda
on: 18-Feb-2007
Format: html
Downloaded on: 20-Jan-2025

1. calculate working days
2. examples:
3. usage
3.1. starting the script
3.2. functions
3.2.1. calc-work-days start, end, holidays
3.3. /non refinement
4. definitions / specification
5. acknowledgements / credits
     Author: Sunanda
    Version: 1.0
       Date: 18-feb-2007
 

1. calculate working days

This script calculates the number of working days between two dates.

2. examples:

     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. usage

3.1. starting the script

do %work-days.r 

3.2. functions

There is just one function with one optional refinement:

3.2.1. calc-work-days start, end, holidays

Where:

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