public static String getXiqijiByDate(String dateStr) throws Exception{
String[] weekOfDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
Calendar calendar = Calendar.getInstance();
if(dateStr != null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(dateStr);
calendar.setTime(date);
}
int index = calendar.get(Calendar.DAY_OF_WEEK) - 1;
if (index < 0){
index = 0;
}
return weekOfDays[index];
}
String[] weekOfDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
Calendar calendar = Calendar.getInstance();
if(dateStr != null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(dateStr);
calendar.setTime(date);
}
int index = calendar.get(Calendar.DAY_OF_WEEK) - 1;
if (index < 0){
index = 0;
}
return weekOfDays[index];
}