工具类:当前写的是判断的是当前年份下的周末
public static boolean isWeek(String startTime) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = df.parse(startTime);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (calendar.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY||calendar.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY) {
return true;
}
return false;
}