根據日期獲取當前的星期數字,比如2013.05.07,星期二。
應該怎麼實現?
Sunday 05.05.2013
Monday 06.05.2013
*Tuesday 07.05.2013
Wednesday 08.05.2013
Thursday 09.05.2013
Friday 10.05.2013
Saturday 11.05.2013
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
SimpleDateFormat sdf = new SimpleDateFormat("EEEE dd.MM.yyyy");
for (int i = 0; i < 7; i++) {
Log.i("dateTag", sdf.format(cal.getTime()));
cal.add(Calendar.DAY_OF_WEEK, 1);
}