Find the difference in days between a java.util.Date and a 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();
}
Just convert Date
to DateTime
and then use Days#daysBetween()
. The DateTime
has a constructor taking the time in millis and the Date
has a getter returning exaclty that.
DateTime lastDate = new DateTime(Obj.getAccepted().getTime());
DateTime currentDate = new DateTime();
int days = Days.daysBetween(lastDate, currentDate).getDays();
链接地址: http://www.djcxy.com/p/36726.html
上一篇: 如何找到两个乔达之间的区别