//根据日期得出本周所有日期 public static List<Date> dateToWeek(Date mdate) { int b = mdate.getDay(); Date fdate; List<Date> list = new ArrayList<Date>(); Long fTime = mdate.getTime() - b * 24 * 3600000; for (int a = 1; a <= 7; a++) { fdate = new Date(); fdate.setTime(fTime + (a * 24 * 3600000)); list.add(a-1, fdate); } return list; } //根据日期获取星期几 public static String getWeek(Date date){ SimpleDateFormat sdf = new SimpleDateFormat("EEEE"); String week = sdf.format(date); return week; } //根据日期得出本月所有日期 private static List<Date> dateToMonth(Date mdate) { List<Date> list = new ArrayList<Date>(); Calendar cal = Calendar.getInstance(); cal.setTime(mdate); cal.set(Calendar.DATE, 1); int month = cal.get(Calendar.MONTH); while(cal.get(Calendar.MONTH) == month){ list.add(cal.getTime()); cal.add(Calendar.DATE, 1); } return list; }