Date math again...
Kenneth Brody
kenbrody at bestweb.net
Wed Jan 4 11:27:52 PST 2006
Quoting Butch Ammon (Wed, 4 Jan 2006 14:07:08 EST):
> Good afternoon,
>
> I have another question regarding dates, calculations, and taking into
> account weekend dates. Isn't there a simple way of doing this?
[...]
> My main question: Does anyone have a quick and easy method of doing
> date math and taking into consideration the weekends inbetween the two
> dates?
[...]
Assuming you want an inclusive range (ie: including both the start and
end dates), you really want start-end+"1".
If the difference between two dates is 7x+y, then there will be precisely
2x weekend days in the first x weeks. Now, all you need to do is figure
out how many weekend days are in the last y days.
If DOW(start) is greater than DOW(end), then there are two weekend days,
as the last partial-week spans the weekend. Otherwise, if the start or
end date is a weekend (DOW is 0 or 6), then they are weekends. Otherwise,
there are no weekend dates in the last partial-week.
Of course, this doesn't take holidays into account.
--
KenBrody at BestWeb dot net spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com
More information about the Filepro-list
mailing list