Re: Date computation
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