Re: Date of next Thursday. An OT response.
Re: Date of next Thursday. An OT response.
- Subject: Re: Date of next Thursday. An OT response.
- From: Paul Skinner <email@hidden>
- Date: Wed, 15 Nov 2000 22:45:06 -0500
The AppleScript Matrix continues...
>
> Is there an easy method to get the date of next Thursday in a script
>
> without a lot of if/thens?
Nigel replied to agent Smith by springing into a crouch on the ceiling
only to explode down on him with a perfect spinning tripple-axle flying
kick...
>
From: Nigel
>
set dref to date "Thursday, 6 January 2000 00:00:00"
>
set nextThursday to dref + (round (((current date) - dref) / weeks)
>
rounding up) * weeks
>
>
NG
BLAM!
Before he could shake his disbelief, from out of the shadows, Michelle
sprang towards the staggering agent and finished him with a barrage of
parenthetical chops to to his syntax!
>
From: Michelle
>
Wonderful! May I add a very small enhancement?
>
>
set nextThursday to date string of (dref + (round ((((current date) + 47
>
* days) - dref) / weeks) rounding up) * weeks)
>
>
This removes the time from the result, leaving only the date.
>
>
--Michelle
WHACK, BLAM, KA-WHACK, WUH-BLAM!
I love this stuff!
Paul
p.s. In no way am I implying that Dave Balderstone is or is not currently an
agent. 8^ )