java对日期的比较的一个小技巧
public boolean compareDateTime(String beginTime, String currentTime, String endTime) {
SimpleDateFormat simpleDate = new SimpleDateFormat();
Date beginDate = simpleDate.parse(beginTime);//解析活动的开始时间
Date currentDate = simpleDate.parse(currentTime);//活动的当前时间
Date endDate = simpleDate.parse(endTime);//活动的结束时间
if(defaultDate.before(currentDate) || defaultDate.after(endDate)) {
return false;
} else {
return true;
}
}