//期望格式模板
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
//到期時間
Date expireTime1= record.getExpireTime();
//當(dāng)前時間
Date nowdate1=new Date();
//Date轉(zhuǎn)為string類型
String expireTime = DateUtils.format(expireTime1, "yyyy-MM-dd");
String nowdate = DateUtils.format(nowdate1, "yyyy-MM-dd");
//并且格式化
Date fexpireTime = sdf.parse(expireTime);
Date fnowdate= sdf.parse(nowdate);
//減出天數(shù)
long stateTimeLong = fnowdate.getTime();
long endTimeLong = fexpireTime.getTime();
//結(jié)束時間扣除現(xiàn)在時間
long day = (endTimeLong-stateTimeLong)/(24*60*60*1000);
record.setCount(day);