Re: Month as Integer, redux
Re: Month as Integer, redux
- Subject: Re: Month as Integer, redux
- From: "Arthur J Knapp" <email@hidden>
- Date: Sat, 07 Apr 2001 15:52:51 -0400
>
Date: Sat, 7 Apr 2001 11:07:02 -0700
>
From: SeaSoft Systems <email@hidden>
>
Subject: Month as Integer, redux
>
... across the list (I love this list) comes Emmanuel Levy's
>
wonderful "french vanilla" version:
>
>> set theDate to the current date
>
>> copy theDate to b
>
>> set the month of b to January
>
>> set monthNum to (1 + (theDate - b + 1314864) div 2629728)
>
Having no real life to speak of, I reviewed this and can offer a
>
slightly simpler solution (in the long tradition of incrementally
>
improving on every offering, however brilliant and well-executed). My
>
small modification replaces the "set monthNum..." statement above by:
>
>
set monthNum to (1 + (theDate - b) div N)
>
>
Interestingly, this works for any integer N in the range [2419200 <=
>
N <= 2505600], so you can pick one that suits your fancy. Proof of
>
this is left as an exercise for interested readers who also have no
>
life. (Hint: consider the number of seconds in the shortest month).
Wow, that is darn clever !!! :)
>
Finally, in deference to Authur's comment:
>
>
> You mean that do don't automatically recognize the number of seconds in
>
>one twelfth of a solar year??? What planet are you from???
>
I must add that scripters from Mars (or other planets whose first
>
month is not the longest) must devise their own month-to-number AS
>
scheme to use with their abducted Macintosh's.
Why is it that only the dumbest Macintoshes that live in the
most rural areas ever claim to have been abducted and probed?
;-)
>
For my part, I will be using
>
>
set monthNum to (1 + (theDate - b) div 2500000)
>
>
because it looks cool to earthlings (and to aliens with ten fingers and toes).
For someone who uses base 19, this might be better:
set monthNum to (1 + (theDate - b) div 2476099)
;-)
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.seanet.com/~jonpugh/