Re: Repaying help by posting small Applescripts
Re: Repaying help by posting small Applescripts
- Subject: Re: Repaying help by posting small Applescripts
- From: Nigel Garvey <email@hidden>
- Date: Fri, 30 Apr 2004 22:35:14 +0100
Christopher Stone wrote on Fri, 30 Apr 2004 07:14:55 -0500:
>
More general:
>
>
-- Swiped from Emmanuel Levy
>
>
on MonthIndexFromDate(theDate)
>
copy theDate to theOtherDate
>
set month of theOtherDate to January
>
1 + (theDate - theOtherDate) div (28 * days)
>
if result < 10 then "0" & result
>
end MonthIndexFromDate
>
>
set d to date "Thursday, May 04, 1961 11:40:00"
>
>
MonthIndexFromDate(d)
>
>
--> 05
Of course, that returns a string for months up to September and no result
otherwise, so for consistency:
on MonthIndexFromDate(theDate)
copy theDate to theOtherDate
set month of theOtherDate to January
(theOtherDate - 252500000 - theDate) div -2500000 as string -- :-)
return text 2 thru 3 of result
end MonthIndexFromDate
NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.