On þri, 2006-08-29 at 19:35 +0100, garry saddington wrote: > I need to count the days between two dates that are not saturdays or > sundays. I have read the manual and searched the lists but I am > struggling. I can count the days but am finding difficulty excluding sat > and sun from the count. I need this without reference to any tables. > Does anyone have any pointers please. how about something like: # assuming d id number of days # and dow is day of week of first day (0-7;sun=0) wholeweeks=days div 7 partial=days mod 7 # adjust dow to mon=0,tue=1...sun=6 dow=(dow+6) mod 7 # count 5 weekdays for each whole week wd=5*wholeweeks # add all days of partial week wd=wd+partial # substract 1 if saturday was included if dow+partial>=6 then wd=wd-1 # substract 1 if sunday was included if dow+partial>=7 then wd=wd-1 # now wd is result hope this helps gnari