//设置系统过期的期限
Date tDate = new Date();
SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");
Date expireDate = new Date();
try {
expireDate = format.parse("2018-4-26");
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
long day=(expireDate.getTime()-tDate.getTime())/(24*60*60*1000);
request.setAttribute("expiremsg", "<font color='red'>本系统即将在 "+day+ " 天后过期,请联系系统管理员处理!</font>");
转载于:https://my.oschina.net/276172622/blog/1794141