java1.8获取年份: int year = Calendar.getInstance().get(Calendar.YEAR); StringBuilder code = new StringBuilder(Integer.toString(year)); //两个时间之间的天数差: int lengthOfEdu= (int) ChronoUnit.DAYS.between(classPlan.getStartTime().toInstant(), classPlan.getEndTime().toInstant());