判断一个日期是否是周六、周日

public static boolean isWeekend(String date) throws ParseException{
		DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");       
		Date bdate = format1.parse(date);
		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 true;
		}
		else return false;
	}

你可能感兴趣的