判断当前日期是否在周范围之内

//strs 周集合,例如  一、二、三、四、五、六    

public static boolean isWeek(String strs){ Calendar calendar = Calendar.getInstance(); int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); String week = ""; Boolean is = false; switch (dayOfWeek) { case Calendar.MONDAY: week = ""; break; case Calendar.TUESDAY: week = ""; break; case Calendar.WEDNESDAY: week = ""; break; case Calendar.THURSDAY: week = ""; break; case Calendar.FRIDAY: week = ""; break; case Calendar.SATURDAY: week = ""; break; case Calendar.SUNDAY: week = ""; break; } List<String> list =Arrays.asList(strs.split(",")); for (int i = 0;i < list.size();i++){ if(list.get(i).equals(week)){ is = true; } } return is; }

 

posted @ 2024-01-20 18:30  _Lawrence  阅读(38)  评论(0编辑  收藏  举报