Number of days between two dates in Joda-Time

后端 未结 8 1266
北恋
北恋 2020-11-22 09:07

How do I find the difference in Days between two Joda-Time DateTime instances? With ‘difference in days’ I mean if start is on Monday and end is on Tuesday I expect a return

8条回答
  •  野性不改
    2020-11-22 09:56

    Days Class

    Using the Days class with the withTimeAtStartOfDay method should work:

    Days.daysBetween(start.withTimeAtStartOfDay() , end.withTimeAtStartOfDay() ).getDays() 
    

提交回复
热议问题