LOCAL m.d1, m.d2, m.nMons
m.d1 = {^2012/02/27}
m.d2 = {^2013/01/31}
m.d1 = {^2012/06/30}
m.d2 = {^2012/07/01}
m.nMons = MonthRange(m.d1, m.d2)
? m.nMons

FUNCTION MonthRange(m.tdFrom, m.tdTo)
LOCAL m.nM, m.dTest, m.dEnd
m.nM = 0
m.dTest = m.tdFrom - DAY(m.tdFrom) + 1 && 1st of the begin month
m.dEnd = GOMONTH(m.tdTo-DAY(m.tdTo)+1,1) && 1st of month after end month
DO WHILE m.dTest<m.dEnd
  m.nM = m.nM + 1
  m.dTest = GOMONTH(m.dTest,1)
ENDDO
RETURN m.nM

Fred


On Wed, Jul 25, 2012 at 1:58 PM, MB Software Solutions, LLC <
mbsoftwaresoluti...@mbsoftwaresolutions.com> wrote:

> On 7/25/2012 4:45 PM, Fred Taylor wrote:
> > What constitutes a month?  Is 2012-06-30 to 2012-07-01 one month or two?
> >   And how would your example be 13?
> >
> > Fred
> >
> >
> > On Wed, Jul 25, 2012 at 1:38 PM, MB Software Solutions, LLC <
> > mbsoftwaresoluti...@mbsoftwaresolutions.com> 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.
>
>
>
> And I was wrong...my example would be 12.
>
>
> --
> Mike Babcock, MCP
> MB Software Solutions, LLC
> President, Chief Software Architect
> http://mbsoftwaresolutions.com
> http://fabmate.com
> http://twitter.com/mbabcock16
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
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/CAJCBksrW9d81k4FrqFj0edvqyKNoAy0H+cCLjRD6CPu6bx=r...@mail.gmail.com
** 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