You probably want to call plusDays(1) on the end date before passing
it to Months.between.
Stephen

On 3 November 2011 09:50, Ludwig Magnusson <lud...@itcatapult.com> wrote:
> Hello!
> First of all thanks for a great api.
> Sometimes, it can be a bit hard to grasp though.
> I’m trying to figure out how to get the number of months covered between two
> dates.
> What I mean is:
> If the start date is january 1 and the end date is january 31 of the same
> year, the number of months covered is 1 since the interval only “touches”
> january. However, if the start date is january 31 and the end date is
> february 2, then the number of months is 2. The interval “touches” both
> january and february.
>
> I have tried to use the Months class but when the start date is 2012-01-01
> and the end date is 2012-12-31 i only get 11 months where I would like 12. I
> guess this is because the period is from the beginning of january 1 to the
> beginning of december 31, not quite a span of 12 months.
>
> Is the functionallity for what I want?
>
> /Ludwig
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to