private String date = "2017-05-21";// SimpleDateFormat simpleDateFormat;
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); b11.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { Date date1 = simpleDateFormat.parse(date); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEEE"); SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("E"); String s1 = simpleDateFormat.format(date1); String s2 = simpleDateFormat2.format(date1); b11.setText(s1 + ":" + s2); } catch (ParseException e) { e.printStackTrace(); } } }); b12.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Calendar calendar = Calendar.getInstance(); String s1 = ""; try { calendar.setTime(simpleDateFormat.parse(date)); } catch (ParseException e) { e.printStackTrace(); } if ((calendar.get(Calendar.DAY_OF_WEEK)) == 1) { s1 = "周日"; } if ((calendar.get(Calendar.DAY_OF_WEEK)) == 2) { s1 = "周一"; } if ((calendar.get(Calendar.DAY_OF_WEEK)) == 3) { s1 = "周二"; } if ((calendar.get(Calendar.DAY_OF_WEEK)) == 4) { s1 = "周三"; } if ((calendar.get(Calendar.DAY_OF_WEEK)) == 5) { s1 = "周四"; } if ((calendar.get(Calendar.DAY_OF_WEEK)) == 6) { s1 = "周五"; } if ((calendar.get(Calendar.DAY_OF_WEEK)) == 7) { s1 = "周六"; } b12.setText(s1); } });