Date math again...
Bob Stockler
bob at trebor.iglou.com
Wed Jan 4 17:57:29 PST 2006
John Esak wrote (on Wed, Jan 04, 2006 at 06:23:35PM -0500):
| Joe's off-the-top was pretty good. I thought about it for a moment and said
| to myself that would be too hard to work out let alone explain it. :-) Very
| good.
|
| Ken's... I put in my "keep" folder and will be thinking about it still when
| ever I go back to find it again. :-) I hear 7x + y and think, uh-oh,
| quadratic equations again! :-) No, seriously, another great idea.
|
| Unfortunately, everyone is right about the holidays. Just put them in t
| lookup file and check if any of the lookup file "dates" fall between or
| equal to the start date and end date. Checking a hard coded array or
| variable list would be clumsy and slower I think then one quick lookup...
I've been playing with it a bit myself, and think that a lookup
to a holidays file would be more expensive that a gosub to a
subroutine (every date checked that is not a Sat or Sun would
require a lookup, and require maintaining two different files).
I visualize the whole thing as being a CALLed table that has only
to be edited once a year (sometime after the following year's
calendar is available - cron could bug the programmer as to when).
The called table checks the DOW() if the day-of-the-week is Sat
or Sun, and then, if not, a gosub in it checks in a subroutine in
it to see if the date being checked is a non-work day.
If: Day eq "02/20/2006" ' Presidents' Day (moveable)
Then: YesNo = "1" ; return
If: Day eq "05/30/2006" ' Memorial Day (fixed)
Then: YesNo = "1" ; return
If: Day eq "07/04/2006" ' Indepenence Day (fixed)
Then: YesNo = "1" ; return
...
Then: YesNo = "" ; return
I think that would be a lot less expensive of programmer (and CPU)
time, involving programmer time but once a year and much less CPU
and HD time doing lookups.
Bob
PS - I wrote a program (datecalc) using AWK that calculates the
days between any two dates between 01/01/0001 to 12/31/9999.
It also can tell the day-of-week of any day in that period.
PSS - I also wrote another AWK program (hcal) that prints the
highlighted date in the centered calendar of a 3-month
calendar for the entered date in the same range as above.
If you don't believe it, get it and enter: "hcal 9/1/1752".
It also prints a 12-month calendar for any year in that
period.
PSPS - I'll email these to anyone who requests them OFF LIST
(if you're not on an OS that has an AWK, don't ask).
--
Bob Stockler +-+ bob at trebor.iglou.com +-+ http://members.iglou.com/trebor
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).
More information about the Filepro-list
mailing list