/** * 判断选择的日期本月的第几天 */ public int getWeeksByChooseDay(){ return calSelected.get(Calendar.DAY_OF_MONTH); } /** * 获取本周的第一天是多少号 以周一为本周的第一天 */ public int getFirstDayOfWeek(){ int mondayPlus=0; int dayOfWeek= calToday.get(Calendar.DAY_OF_WEEK)-1;//一周一为一周的第一天 if (dayOfWeek == 1) { mondayPlus = 0; } else { mondayPlus = 1 - dayOfWeek; } GregorianCalendar currentDate = new GregorianCalendar(); currentDate.add(GregorianCalendar.DATE, mondayPlus); Date monday = currentDate.getTime(); DateFormat df = DateFormat.getDateInstance(); String preMonday = df.format(monday); return Integer.parseInt(preMonday.split("-")[2]); }