给定一个年月!获取每月每天所对应的星期
public class Test030 { public static void main(String[] args){ String s = "2013/9"; SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd"); sdf1.setLenient(false); SimpleDateFormat sdf2 = new SimpleDateFormat("EEE"); for(int i = 1; i < 32; i++){ try { Date date = sdf1.parse(s + "/" + i); System.out.println(sdf1.format(date) + " : " + sdf2.format(date)); } catch (ParseException e) { //do nothing } } }

浙公网安备 33010602011771号