working days calculations
Pam & Tony Knowles
ajk@ihug.co.nz
Fri, 5 May 2000 17:40:59 +1200
Chris
I recently had a similar problem, to add a certain number of working days to
a known date. I used the rather inelegant (but it works) solution of
repetitively incrementing the start date by one day and adjusting the new
date if it was a weekend date. Clumsy, but as I say it works. I also set up
a file with public holiday dates in and built that into the calculation.
Tony
> -----Original Message-----
> From: owner-powerh-l@sphere.swau.edu
> [mailto:owner-powerh-l@sphere.swau.edu]On Behalf Of Chris Sharman
> Sent: Friday, 5 May 2000 04:01
> To: powerh-l@lists.swau.edu
> Cc: Chris.Sharman@ccagroup.co.uk
> Subject: working days calculations
>
>
> Anyone know of an elegant way of doing working days calculations ?
>
> Ie adding/subtracting a number of working days to a date.
>
> Adding calendar days is easy: DEFINE newdate DATE = DATE(numdays,olddate)
> Taking weekends into account is quite messy:
> I get the weekday using MOD(DAYS(olddate),7) and use a
> conditional expression.
> Eg:
> def despdate vmsdate = date(-1.29166667,delivery-date) &
> if (2<mod(days(delivery-date),7)) &
> else date(-3.29166667,delivery-date)
>
> This says for delivery Wed-Sat, we need to despatch by 5pm Mon-Thu;
> and for delivery Sun-Tue, we need to despatch by 5pm Wed-Fri
> It probably ought to be more complicated than that.
>
> However, to take account of bank holidays, it gets a whole lot
> worse, and the
> complexity is dependent on how many days you need to add/subtract.
>
> What I really need is a way to write my own Powerhouse functions, I think.
> Do external would do for Quick, but I really need a solution for Quiz.
>
> Anybody ?
>
> Thanks,
> Chris
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.