*/ public static HashMap<String, String> computeDate(){ Calendar cal =Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); HashMap<String, String> map = new HashMap<String, String>(); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); //获取本周一的日期 // System.out.println(df.format(cal.getTime())); map.put("MONDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); //获取本周二的日期 // System.out.println(df.format(cal.getTime())); map.put("TUESDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); //获取本周三的日期 // System.out.println(df.format(cal.getTime())); map.put("WEDNESDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); //获取本周四的日期 // System.out.println(df.format(cal.getTime())); map.put("THURSDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); //获取本周五的日期 // System.out.println(df.format(cal.getTime())); map.put("FRIDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); //获取本周六的日期 // System.out.println(df.format(cal.getTime())); map.put("SATURDAY", df.format(cal.getTime())); //这种输出的是上个星期周日的日期,因为老外那边把周日当成第一天 cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); //增加一个星期,才是我们中国人理解的本周日的日期 cal.add(Calendar.WEEK_OF_YEAR, 1); // System.out.println(df.format(cal.getTime())); map.put("SUNDAY", df.format(cal.getTime())); return map; }