1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| //设置月 Date time = Calendar.getInstance(Locale.CHINA).getTime(); int year = 1900 + time.getYear(); int month = time.getMonth(); String currentMonth = (month + 1) + "月";
//填充当月天数 int dayCountOfCurrentMonth = SelectDateUtil.getDayCountOfCurrentMonth() + 1; //10月 31天 +1是为补当月最后一天 Calendar instance = Calendar.getInstance(Locale.CHINA); for (int i = 0; i < dayCountOfCurrentMonth; i++) { String s = (i) + ""; instance.set(year, month, i); Date time1 = instance.getTime(); String dayOfWeekFromDate = SelectDateUtil.getDayOfWeekFromDate(time1); //Log.e(TAG, "loadData: " + s + " -- " +time1 + " -- " + dayOfWeekFromDate); selectDates.add(new LPCSelectDate(s, dayOfWeekFromDate)); } selectDates.remove(0); //移除第一位上个月的最后一天 lpcDateSelectAdapter.notifyDataSetChanged();
|