private String getWeek(String date) { String[] arr=date.split("-"); Calendar calendar = Calendar.getInstance();//获得一个日历 calendar.set( Integer.parseInt(arr[0]),Integer.parseInt(arr[1])-1, Integer.parseInt(arr[2]));//设置当前时间,月份是从0月开始计算 int number = calendar.get(Calendar.DAY_OF_WEEK);//星期表示1-7,是从星期日开始, String [] str = {"","星期日","星期一","星期二","星期三","星期四","星期五","星期六",}; return str[number]; }