SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
Date date=sdf.parse(user.getYxrq());
Calendar yxrq=Calendar.getInstance();
yxrq.setTime(date);//指定calendar的时间
Calendar now=Calendar.getInstance();
yxrq.compareTo(now) 相当于--> yqrx-now
if(yxrq.compareTo(now)<=0){
//账号过期
writer.print("-3");
return null;
}
//计算两个时间的差
long cha=(yxrq.getTimeInMillis()-now.getTimeInMillis()) / (1000 * 60 * 60 * 24);