我是android新手,我已经开发了一个应用程序,现在我想申请每月订阅,我必须跟踪日期,我已经尝试了以下代码
try {
before = (Date)formatter.parse(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Date now = new Date();
long diff = now.getTimeInMillis() - before.getTimeInMillis();
long days = diff / ONE_DAY;
if(days > 30) { // More than 30 days?
// Expired !!!
}
它在 long diff = now.getTimeInMillis() - before.getTimeInMillis() 处给出错误;
那么你能告诉我这个的替代方法是什么吗?