需求如题
public static String isWeekend(String bDate) throws ParseException {
DateFormat format1 = new SimpleDateFormat("yyyy/MM/dd");
Date bdate = format1.parse(bDate);
Calendar cal = Calendar.getInstance();
cal.setTime(bdate);
if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){
return "OK";
} else{
return "NO";
}
}
转自:https://blog.csdn.net/tingwufeixiang/article/details/70755713