Re: A Difference of Months
Re: A Difference of Months
- Subject: Re: A Difference of Months
- From: Arthur J Knapp <email@hidden>
- Date: Wed, 13 Mar 2002 09:59:43 -0500
>
Date: Wed, 13 Mar 2002 11:50:28 +1100
>
Subject: Re: A Difference of Months
>
From: Shane Stanley <email@hidden>
>
On 13/3/02 8:55 AM +1000, Arthur J Knapp, email@hidden, wrote:
>
>
> So I need to find how many months difference there are between any
>
> two dates.
>
> Months are not as simple, however, because they have a differing
>
> number of days.
>
If you're happy to disregard days, why not just get the number of months of
>
each date by multiplying the years by 12 and adding the current month:
>
on getMonths(theDate)
>
copy theDate to b
>
set month of b to January
>
set theMonths to ((year of theDate) * 12) + (1 + (theDate - b + 1314864)
>
div 2629728)
>
return theMonths
Thank you Shane, this is brilliant and so simply. :)
Simply multiplying a year by 12 gives a total month count from
the turn of the century, from there, we adjust for "whole" month
differences in the two dates.
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www.appleklub.cz/~koudelka/home.shtml>
on error number -128
end try
}
_______________________________________________
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.