On 1/6/2011 9:35 AM, Elbert Cook wrote:
DateDiff = %diff(Date1 : Date2 : *days) / 30;


It may be better to get the diff in months first, then get the number of days left over, and divide that by 30 or probably better 30.5.

NumMonths = %diff(Date1 : Date2 : *months);
NumDays = %diff(Date1 : Date2 + %months(%int(NumMonths)) : *days);
NumMonths += NumDays / 30.5;

It depends what you want the answer to be for say the difference between Feb 15 and March 15. Do you want that to be exactly one month, or do you want that to be a partial month?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.