Re: Month as Integer
Re: Month as Integer
- Subject: Re: Month as Integer
- From: Johan Solve <email@hidden>
- Date: 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)
On 11/29/00 10:41 AM, Pier Kuipers <email@hidden> wrote
Here's what I use to get the month's number:
on GetMonthNumber()
set theMonth to month of (current date)
set theMonthList to {January, February, March, April, May, June,
July, August, September,
October, November, December}
set x to 1
repeat with i from 1 to 12
if (item x of theMonthList) is (theMonth) then
set y to x
exit repeat
else
set x to x + 1
end if
end repeat
set theMonthNumber to x
end GetMonthNumber
Why not this:
on GetMonthNumber()
set theMonth to month of (current date)
set theMonthList to {January, February, March, April, May, June, ,
July, August, September, ,
October, November, December}
repeat with i from 1 to 12
if (item i of theMonthList) is (theMonth) then return i
end repeat
end GetMonthNumber
--Michelle
--
Johan Svlve
Web Application/FileMaker Developer
MONTANIA SOFTWARE & SOLUTIONS [FSA Member]
http://www.montania.se mailto:email@hidden
Halmstad Branch: Brogatan 16, SE-30243 Halmstad
phone +46 35-127205 fax +46 35-2802654 mobile +46 709-515570
Ronneby HQ: Soft Center , SE-37225 Ronneby
phone +46 457-386200 fax +46 457-26479