• 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: Date computation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date computation


  • Subject: Re: Date computation
  • From: Barry Wainwright <email@hidden>
  • Date: Fri, 07 Jan 2005 21:22:44 +0000

On 7/1/05 8:18 am, "Michelle Steiner" <email@hidden> wrote:

> I've run into a brick wall here.  I'm trying to compute the date of the
> second Wednesday of the current month, and if the current date is later
> than or equal to that date, then compute the date of the second
> Wednesday of the following month.
>
> -- Michelle

This should load the script in full:
    http://tinyurl.com/49lwf

If that doesn't work, then copy/paste from here (watch out for linewraps):

set today to current date
set secondWednesday to (word 4 of paragraph 4 of (get do shell script "cal")
as integer) mod 7 + 7
if secondWednesday > day of today then
    set day of today to secondWednesday
    return today
else
    set {theYear, theMonth} to {year of today, month of today as integer}
    if theMonth = 12 then
        set {theMonth, theYear} to {1, theYear + 1}
    else
        set theMonth to theMonth + 1
    end if
    set secondWednesday to (word 4 of paragraph 4 of (get do shell script
"cal " & theMonth & " " & theYear) as integer) mod 7 + 7
    return date ("" & secondWednesday & "/" & theMonth & "/" & theYear) --
change the order of these elements for US date format
end if

--
Barry



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Date computation (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Here is the completed script
  • Next by Date: corrupted messages in Eudora - how to reset status w/ AS? (answer)
  • Previous by thread: Re: Date computation
  • Next by thread: Re: Date computation
  • Index(es):
    • Date
    • Thread