× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The down side of the traditional calendar approach is that calculating long
lead times requires a lot of reads.  There's a sneakier way.

Create a calendar file that basically has a date and a "working day number".
Create views by both date and day number.  For example, if January 1st was a
holiday and you excluded weekends, the first 10 records in the file for this
year would be:

2007, 01/02, 1
2007, 01/03, 2
2007, 01/04, 3
2007, 01/05, 4
2007, 01/08, 5
2007, 01/09, 6
2007, 01/10, 7
2007, 01/11, 8
2007, 01/12, 9
2007, 01/15, 10

If you wanted to find the sixth working day after January 4th, you'd chain
with 01/04 to the date view and get the value 3, add 6 to that to get 9,
then chain on the day number view to get 01/12.

The database layout above separates the year portion of the date from the
month and day.  If you have to span years, you can use a special record with
no date (and just the year) to specify the number of working days in the
year.  This is the "Julian" method.

An alternate solution would be to use the entire date and then your day
number would be a consecutive number of working days from some arbitrary
date in the past.  Just make sure your day number field has at least 5
digits (that will get you a couple of hundred years).  This is the "Lillian"
method, and is probably a little easier.

This technique also allows you to quickly calculate the number of working
days between two working dates (and with just a little more work, between
any two dates).  Simple modifications of the database support multiple
calendars and even rough-cut capacity planning.

Joe



From: nike@xxxxxxxxxxxxxx

Do you have a calendar file which indicates working days versus non-
working days?

Excluding Saturday and Sunday is a start, but you also probably want to
exclude holidays.

Most packages use some sort of work calendar to track such things, or you
could create one yourself.  Then you chain to the current date and read
forward until you have gone X working days (ignoring days flagged as
non-working).

hth,
JD



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.