• 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: jj <email@hidden>
  • Date: Fri, 07 Jan 2005 10:21:04 +0100

> 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

Hi, Michelle!

While the date-calculation-geeks come to the rescue, you can play with this
(not very tested, though):

#####################################
set weekdayList to "
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
"
set currentDate to current date
copy currentDate to previousDate

set day of previousDate to 1
set wd to weekday of previousDate as text
--> credits to Emmanuel for the following line:
set nwd to (-1 + (count (paragraphs of (text 1 thru (offset of (return & wd
& return) in weekdayList) of weekdayList))))

set secondWednesday to 14 + (4 - nwd)
#####################################

Given the secondWednesday, you can compare to the current date, and
calculate if needed the secondWednesdayOfNextMonth repeating the code plus
adding a "set month of currentDate to blah + 1".


jj

--
http://www.macscripter.net/
http://www.osaxen.com/


 _______________________________________________
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: RE: ftp chokes my mac....
  • Next by Date: Re: FileMaker 7 AppleScript problems...
  • Previous by thread: Date computation
  • Next by thread: Re: Date computation
  • Index(es):
    • Date
    • Thread