Re: Month as Integer
Re: Month as Integer
- Subject: Re: Month as Integer
- From: Nigel Garvey <email@hidden>
- Date: Fri, 1 Dec 2000 00:11:49 +0000
Johan Solve wrote on Thu, 30 Nov 2000 09:19:39 +0100:
>
Would it be possible to do something like this:
>
>
on GetMonthNumber()
>
set theMonth to month of (current date)
>
set theMonthList to {January:1, February:2, March:3, April:4, May:5, -+
>
June:6, July:7, August:8, September:9, October:10, -+
>
November:11, December:12}
>
return themonth of themonthlist
>
end GetMonthNumber
>
>
I know it doesn't work as it stands but maybe it's just a matter of
>
coding it right.
>
'return November of themonthlist' works fine, so the question really
>
is how you specify a named record by a variable? (wasn't this
>
discussed recently? I think it was about using variable variable
>
names but that should be related)
[Quotes from Pier Kuipers and Michelle Steiner]
That would be a very smart and fast method if it worked, though I'm
afraid I haven't been able to make it do so yet. The fastest and simplest
way of getting the month number that I know is that attributed to
Emmanuel Livy, which would look like this in the given handler:
on GetMonthNumber()
set theDate to (current date)
copy theDate to b
set the month of b to January
return 1 + (theDate - b + 1314864) div 2629728
end GetMonthNumber
NG