working days calculations
Chris Sharman
Chris.Sharman@ccagroup.co.uk
Thu, 4 May 2000 17:00:36 +0100
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
_______________________________________________________________________
Chris.Sharman@CCAgroup.co.uk http://www.ccastat.demon.co.uk/
CCA Stationery Ltd, Eastway, Fulwood, Preston, Lancashire, PR2 9WS.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
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.