• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: A Difference of Months
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Difference of Months


  • Subject: Re: A Difference of Months
  • From: Shane Stanley <email@hidden>
  • Date: Wed, 13 Mar 2002 11:50:28 +1100

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. If it was a question of days, it would be very simple:
>
> Months are not as simple, however, because they have a differing
> number of days. The only *simple* technique that can be used is to
> find an approximation of months difference:

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
end getMonths

--
Shane Stanley, email@hidden
_______________________________________________
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.

References: 
 >A Difference of Months (From: Arthur J Knapp <email@hidden>)

  • Prev by Date: Re: Questions questions...
  • Next by Date: Re: Questions questions...
  • Previous by thread: Today's High-Speed Mt.Fuji
  • Next by thread: Re: A Difference of Months
  • Index(es):
    • Date
    • Thread