Re: Date computation
Re: Date computation
- Subject: Re: Date computation
- From: Andrew Oliver <email@hidden>
- Date: Fri, 07 Jan 2005 02:49:34 -0800
On 1/7/05 12: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
Here's my solution.
It relies on the fact that the earliest date the second Wednesday can be is
the 8th of the month (if the first day of the month is a Wednesday)
set tempDate to (current date)
set day of tempDate to 8
repeat until weekday of tempDate is Wednesday
set day of tempDate to (day of tempDate) + 1
end repeat
return tempDate
In layman's terms, get the current date (can be any date in the month you're
working on), set the day of that date object to the 8th, then increment one
day until you get to a Wednesday. The repeat loop will never run more than 6
times, so it should be pretty quick.
Andrew
:)
_______________________________________________
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