Calendar time=Calendar.getInstance(); time.clear(); time.set(Calendar.YEAR,2018); //year年 time.set(Calendar.MONTH,1); //Calendar对象默认一月为0,month月 int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//本月份的天数 System.out.println(day);
本文共 313 字,大约阅读时间需要 1 分钟。
Calendar time=Calendar.getInstance(); time.clear(); time.set(Calendar.YEAR,2018); //year年 time.set(Calendar.MONTH,1); //Calendar对象默认一月为0,month月 int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//本月份的天数 System.out.println(day);
转载于:https://www.cnblogs.com/fengdaren/p/8820789.html