Hey, 

I do something like this for a hiring company when working out "overhire"
extension invoices.  Some of them I have to work out weeks and others get
calculated in months.

I use this and it works for me.  They don't have anything more than 2 years
old (famous last words...) that need extending hire.

Ldextfndate = the date that I'm extending up to - end of month - eg the end
of June 30/6/12
Pdfndate = the last date they were extended up to - could be any date up to
2 years ago  (usually the month before, but sometimes up to 6 months ago)


*  first check how far apart the years are
DO CASE
        CASE YEAR(ldextfndate) - YEAR(pdfndate) = 0  && then we are
comparing two dates in the same year 
                lnmonthstobill = MONTH(ldextfndate) - MONTH(pdfndate) 
                
        CASE YEAR(ldextfndate) - YEAR(pdfndate) = 1  && then the years are 1
year apart - this is fine - extending something from December into January
for example
                lnmonthstobill = (12 - MONTH(pdfndate)) + MONTH(ldextfndate)
                
        CASE YEAR(ldextfndate) - YEAR(pdfndate) = 2 && then the years are 2
years apart 
                lnmonthstobill = (24 - MONTH(pdfndate)) + MONTH(ldextfndate)
ENDCASE

Hope you find something in it you might use.


Christina Bull
DataHouse



On Thu, Jul 26, 2012 at 4:38 AM, MB Software Solutions, LLC
<[email protected]> wrote:
> Input is 2 dates...I need to count the number of months between (and
> including) them.  example: 2012-02-27 to 2013-01-31 would be 13.

--


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to