You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
about the february month there is a strange behavior that you can see in the incorect results with jodatime, you can look down here :
DateTime date4 = new DateTime(2013, 5, 29, 0, 0, 0, 0);
DateTime date4PlusNineMonths = new DateTime(2014, 2, 28, 0, 0, 0, 0);
Period period4 = new Period(date4, date4PlusNineMonths);
//Incorrect result
System.out.print(date4.toString("dd/MM/YYYY")+".plusMonths(9) = "+ date4.plusMonths(9).toString("dd/MM/YYYY"));
System.out.print(period4.getYears() +"Years/"+ period4.getMonths() +"Months/"+ period4.getWeeks() +"Weeks/"+ period4.getDays() +"Days");
Output :
29/05/2013.plusMonths(9) = 28/02/2014 //incorrect result should be 01/03/2014
0Years/9Months/0Weeks/0Days
This is an incorrect calculation It should be 0Years/8Months/4Weeks/2Days Isn't it...?
If it is correct so why when I increase two days more (30 and 31) it always give me the same calculation (0Years/9Months/0Weeks/0Days) we all agree that days are really decreasing or am I dreaming...?
Now maybe I wrong in my use of the joda framework because in the app I develop I do a check everyday on a period to have the precise month separation between two date (toDay and the next date) and if I have 9months and 1day it's too late I need to have 9months and 0days as required in my app =/
If I wrong how can I achieve this please...?
The text was updated successfully, but these errors were encountered:
This is the correct result, I've updated the Javadoc. It may not be the obvious result, but it does work in that startDate.plus(calculatedPeriod)=endDate.
There is no functionality to match what you want. However the Period.fieldDifference() method may help you.
about the february month there is a strange behavior that you can see in the incorect results with jodatime, you can look down here :
Output :
29/05/2013.plusMonths(9) = 28/02/2014 //incorrect result should be 01/03/2014
0Years/9Months/0Weeks/0Days
This is an incorrect calculation It should be 0Years/8Months/4Weeks/2Days Isn't it...?
If it is correct so why when I increase two days more (30 and 31) it always give me the same calculation (0Years/9Months/0Weeks/0Days) we all agree that days are really decreasing or am I dreaming...?
Now maybe I wrong in my use of the joda framework because in the app I develop I do a check everyday on a period to have the precise month separation between two date (toDay and the next date) and if I have 9months and 1day it's too late I need to have 9months and 0days as required in my app =/
If I wrong how can I achieve this please...?
The text was updated successfully, but these errors were encountered: