How to compare dates in Android app?

This question already has an answer here:

  • Number of days between two dates in Joda-Time 6 answers

  • I would say it is not printing 1 but -1 .

    The compare function just compares two dates, it does not compute a time difference. Check the Joda Time documentation for more information. Also, I suggest you to read about the more general Java interface Comparator which is a fundamental unit of the Java language.

    I've never used Joda Time so far, but I read here that the solution to your problem might be

    Days.daysBetween(actionDate.toDateMidnight(), DateTime.now().toDateMidnight()).getDays()
    
    链接地址: http://www.djcxy.com/p/36656.html

    上一篇: 使用joda从开始和结束找到天数差异?

    下一篇: 如何比较Android应用中的日期?