查找java.util.Date和Joda之间的天数差异

是否有可能找到java.util.Date和Joda-Time DateTime之间的差异(最好用天数表示)?

class ReminderInterval{
    //it will return a last login date(java.util.Date)
    Date lastDate=Obj.getAccepted();

    //it is Joda-Time type
    DateTime currentDate=new DateTime();
}

只是转换Date ,以DateTime ,然后用Days#daysBetween() DateTime有一个构造函数以毫秒为单位, Date有一个返回exaclty的getter。

DateTime lastDate = new DateTime(Obj.getAccepted().getTime());
DateTime currentDate = new DateTime();
int days = Days.daysBetween(lastDate, currentDate).getDays();
链接地址: http://www.djcxy.com/p/36725.html

上一篇: Find the difference in days between a java.util.Date and a Joda

下一篇: Difference in days between two dates in Java?