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";
}
}
java 判断日期是否是周末
最新推荐文章于 2024-04-23 14:29:25 发布