java判断简单判断工作日还是周末日还是周末
//工作日还是周末 private boolean checkTimeIsWork() { boolean flag = false; try { DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String date = sdf.format(new Date()); Date testdate = sdf.parse(date); Calendar cal = Calendar.getInstance(); cal.setTime(testdate); int x = cal.get(Calendar.DAY_OF_WEEK); switch (x) { case Calendar.MONDAY: case Calendar.TUESDAY: case Calendar.WEDNESDAY: case Calendar.THURSDAY: case Calendar.FRIDAY: flag = false; break; case Calendar.SATURDAY: case Calendar.SUNDAY: flag = true; break; } } catch (ParseException e) { e.printStackTrace(); } return flag; }