标签:bsp false 当前时间 time() class highlight set gettime 获取
public boolean isLatestWeek(Date addtime,Date now){
Calendar calendar = Calendar.getInstance(); //得到日历
calendar.setTime(now);//把当前时间赋给日历
calendar.add(Calendar.DAY_OF_MONTH, -7); //设置为7天前
Date before7days = calendar.getTime(); //得到7天前的时间
if(before7days.getTime() < addtime.getTime()){
return true;
}else{
return false;
}
}
addTime 是要校核的时间
now 是获取的当前是时间
标签:bsp false 当前时间 time() class highlight set gettime 获取
原文地址:http://www.cnblogs.com/fireinwater/p/6659489.html