Sarah, Sean or another time bandit - help needed on dates calcs
Bryan McCormick
bryan at deepfoo.com
Tue Apr 3 13:25:08 EDT 2007
OK,
I have persnickety date issues (thankfully just dates) which I think
Sarah or Sean or another time bandit may be able to help with.
Here is the issue. I have a collection of date pairs that look perfectly
innocent, something like "8/11/2003" to "8/11/2004" for which I need to
calculate the daysBetween.
No problem right? Sarah's handy dandy (and it is ever so minxy and cool)
date & items stack to the rescue. Easy peasy.
In part yes since the weekNumISO I am guessing is part of the solution.
Except that the problem is I must:
A) count only weekdays between since this is a "business days" problem
based on a five day week.
-- easy enough except when the dates span multiple years right?
-- but wait, do I or don't I need to count each instance of a Saturday
and Sunday over each week between the dates to be totally sure?
B) I have to take account of standard US holiday closings
-- excluding those that fell on a weekend and thus have to be
accounted for since they were observed on different days.
C) I need to add in specific dates of the year to exclude from the
calculation when the business itself was closed other than on holidays.
-- thankfully these at least are known and there is history for them
-- again this looks "ugly" like days themselves will need to be poked
off the list. as an example, the week of 9/11 in NYC shut down many
businesses for weeks so those dates need to be excluded on a case by
case basis
As with my other problems posted to the list, all of the huff and puff
is before I even get to the analysis part of the job. Oddly that part is
dead easy by comparison. This date arithmetic is not so easy.
I browsed the list, thought it through, poked around some more, and
nothing brilliant came to mind other than to ask smarter people.
----------------------------------------
PS - The archive of the mail list has many wonderful things in it but it
seems like a treasure trove ignored. It has become in some ways so big
it is getting hard to walk through it all and threads do not seem to
cross year bounds so there are many, many instances where same/similar
posts (perhaps this one even) are done over and over and over.
Has anyone thought of simply reorging this into something that could be
made into more of a "real" how to build things with Rev product? I would
think it would help sell the product. Just my dime (2c adjusted for
inflation since 1970).
More information about the use-livecode
mailing list