Calendar calendar = Calendar.getInstance();
String[] arrDate = new String[5];
String[] arrWeek = new String[5];
for(int i=0; i<5; i++) {
calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY+i);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd EE");
String Date1 = dateFormat.format(calendar.getTime());
String dateStr1 = dateFormat.format(calendar.getTime());
String[] strArr = dateStr1.split(" ");
//存放日期
arrDate[i] = strArr[0];
//存放周几
arrWeek[i] = strArr[1];
}
时间: 2024-10-05 04:58:05