Re: Date computation
Re: Date computation
- Subject: Re: Date computation
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 07 Jan 2005 11:45:36 -0800
On 1/7/05 11:25 AM, "Michelle Steiner" <email@hidden> wrote:
>
>> Midnight on a known Wednesday in the past is subtracted from b
>
> Let's see; that gives us the number of seconds between the 14th of the
> current month and that known date.
>
>> and the
>> result is modulated by 'weeks' to leave the difference between midnight
>> on most recent Wednesday (ie. the second one of this month) and the
>> date/time of b.
>
> The difference, expressed in what units? And I still don't see where
> the most recent Wednesday is achieved here.
'modulated', i.e. mod, gets you the remainder after whole number division.
(103 mod 10 = 3)
It doesn't matter how many weeks have passed since that "known Wednesday" in
1900 - dividing (the number of seconds resulting from subtracting that
Wednesday date from any other date) by 'weeks' (i.e. 7 * 24 * 60 * 60
seconds) will be the mod remainder: the number of seconds since the most
recent Wednesday midnight.
>>> tell b to set {day, day} to {32, 14}
>
> And I certainly don't understand that.
That looks like a typical Nigel trick. I think that if you try to set the
day of any date to 32 AppleScript gives you the 1st of the succeeding month
- it saves a LOT of computation. Then is seems you can set the day to 14
again by doing it twice in a list like this instead of writing a second
line, i.e. instead of
set b's day to 32 -- changes date to 1st of next month
set b's day to 14
just
tell b to set {day, day} to {32, 14}
I just tried it and that's what it does. I didn't know that. Trust Nigel to
figure that one out - he must have worked out it saves a billionth of a
second in computation time or something.;-)
--
Paul Berkowitz
_______________________________________________
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