已知一个时间 Date businessDateTime 已知
1 Calendar cal = Calendar.getInstance(); 2 cal.setTime(businessDateTime); 3 int year = cal.get(Calendar.YEAR); 4 int month = cal.get(Calendar.MONTH) + 1;
获取当前月具有的天数:
1 Integer dayCount = LocalDate.now().withMonth(localDate.getMonthValue()).lengthOfMonth();