New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date difference in months for dates #325
Comments
why would those tools (SPSS, MySQL, Excel) report 0 or 10... the difference to any sane person would be what Joda time is reporting. |
Seems like he wants to round down. |
last day of the month to last day of the next month would be 1 month difference. I'm not seeing why you would expect a different result. |
I guess the last day is not included. Is there an option to include or not
|
According to Microsoft, the excel calculation is
If you relate both examples to this excel code, it makes sense. May has not yet passed the 31st day of the month, which would only occur on June 1st, and therefore a month has not yet passed. |
@mvkk, there's an issue I spotted when creating unit tests. The inverse does not make sense. For example, in your first example, 3/31/13 to 4/30/13 is suppose to have 0 months in between, but what would happen if you flipped the order so that you're looking for the months between 4/30/13 and 3/31/13. That would then be -1 months going backwards whereas 0 months going forward. |
That is true. The reverse does not make sense. My suggestion would be to On Tue, Nov 3, 2015 at 1:05 AM, AdrianAcala notifications@github.com
|
Whether this is the right behaviour or not is slightly moot at this point. Joda-Time has worked this way for many years, so I'm not changing it. |
Behaviour in this area is long standing and should not be changed See #325
Hi Stephen, Regards On Thu, Jan 28, 2016 at 8:13 AM, Stephen Colebourne <
|
Behaviour in this area is long standing and should not be changed See JodaOrg#325
Just to note that
As stated above however, I won't be updating Joda-Time (which is primarily in maintenance mode). |
I used the monthsBetween method to calculate months between dates and here is the summary of the outcomes:
1.'2013-03-31' and '2013-04-30' - Difference is 1
2. '2013-03-31' and '2014-02-28' - Difference is 11
While I get 0 for first and 10 for second set using SPSS, MySQL, Excel.
Is there any way we can get monthsBetween match results?
The text was updated successfully, but these errors were encountered: