• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Has the 5th business day of the month passed???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Has the 5th business day of the month passed???


  • Subject: RE: Has the 5th business day of the month passed???
  • From: "Bourque, Jason" <email@hidden>
  • Date: Fri, 23 Feb 2001 11:58:27 -0500

I found this site on the net it contains algorithms for finding dates. I
think I will use them instead of repeat loops

http://www.smart.net/~mmontes/ushols.html


Jason Bourque
AppleScript Developer
MFS Investment Management


> ----------
> From: email@hidden
> Sent: Thursday, February 22, 2001 10:50 PM
> To: email@hidden
> Subject: Re: Has the 5th business day of the month passed???
>
> On Thu, 22 Feb 2001 21:26:54 +0000, Nigel Garvey <email@hidden>
> asked,
>
> > Of course, it doesn't make allowances for public holidays. For this, you
>
> > need to make an adjustment in months that have (one!) public holiday in
> > their first five business days. From the list in Jason's revised script,
>
> > these look to be January, July, and August in the US.
>
> I had some work that required my scripts to deal with working days and
> holidays,
> so I wrote a script object that understands them.
>
> Memorial Day in the US is challenging to code correctly, because it is the
> last
> Monday in May. But I was able to cover it, and all the other floating
> holidays,
> with a data structure: I created a list of "ordinals" that represent these
> holidays. An ordinal is a list like this: { 3, Monday, January } for
> Martin
> Luther King Day, the third Monday in January. I then calculate a date in
> question's ordinal as
>
> { ((day of testDate) -1 ) div 7 + 1, weekday of testDate, month of
> testDate }
>
> and use "is in" to see if its in the holiday list. For Memorial Day, I
> use
> AppleScript's convention that item -1 is the last item, -2 is the
> second-to-last, etc. I represent Memorial Day as { -1, Monday, May} and
> calculate a negative ordinal
>
> { (( day of (lastDateInMonth for testDate))- (day of testDate))div -7 -
> 1,
> ...
>
>
> With this package, testing if the fifth business day has past becomes
>
> property WorkingDays: load script alias "Where:ever:Working Days"
> set firstOfMonth to current date
> set day of firstOfMonth to 1
>
> tell WorkingDays
> if (workingTime from firstOfMonth to current date) > 5 * (its
> dailyTime)
> then
> --- Five business days have passed
>
> I've posted this script object on my web site at
>
> http://www.tidalwave.net/~snorton/
>
> --
> Scott Norton Phone: +1-703-299-1656
> DTI Associates, Inc. Fax: +1-703-706-0476
> 2920 South Glebe Road Internet: email@hidden
> Arlington, VA 22206-2768 or email@hidden


  • Prev by Date: Re: Ircle Script
  • Next by Date: Re: magic integer converter number 62? - Joking???
  • Previous by thread: Re: Has the 5th business day of the month passed???
  • Next by thread: Michelle - Embedding a sound
  • Index(es):
    • Date
    • Thread