安卓获取当前周的日期
List<String> list = new ArrayList<String>(); Calendar ca = Calendar.getInstance(Locale.CHINESE); int start = ca.getFirstDayOfWeek(); int end = ca.getMaximum(Calendar.DAY_OF_WEEK); for (int i = start; i <= end; i++) { ca.set(Calendar.DAY_OF_WEEK, i); String aString=ca.getTime().toString(); String dateString; if (aString.subSequence(8, 9).equals("0")) { dateString=aString.substring(9, 10); }else { dateString=aString.substring(8, 10); } list.add("" + dateString); } String da[] = list.toArray(new String[list.size()]); date1.setText(da[0]); date2.setText(da[1]); date3.setText(da[2]); date4.setText(da[3]); date5.setText(da[4]); date6.setText(da[5]); date7.setText(da[6]);
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。