我使用下面的代码来获得在今年2个日期之间的差异,月,日乔达时期年月日
tenAppDTO.getTAP_PROPOSED_START_DATE()=2009-11-01
tenAppDTO.getTAP_PROPOSED_END_DATE()=2013-11-29
ReadableInstant r=new DateTime(tenAppDTO.getTAP_PROPOSED_START_DATE());
ReadableInstant r1=new DateTime(tenAppDTO.getTAP_PROPOSED_END_DATE());
Period period = new Period(r, r1);
period.normalizedStandard(PeriodType.yearMonthDay());
years = period.getYears();
month=period.getMonths();
day=period.getDays();
out.println("year is-:"+years+"month is -:"+ month+"days is -:"+ day);
通过上面的代码我得到的结果是 - 一年:4月份是 - : 0天 - :0 但实际的结果是每年为 - 4月份是 - :0天 - 28
请提供一个解决方案
非常感谢你! – nakul
@nakul: - 不客气! –
@RahulTripathi你能解释**新期间(r,r1,day); **是如何工作的吗?为什么我们需要在其中包含一天? – Keerthivasan