| | |
| | | return time.withHour(23).withMinute(59).withSecond(59).withNano(999999999); |
| | | } |
| | | |
| | | /** |
| | | * 计算一年的天数 |
| | | * @param year 年份 |
| | | * @return year指定的年份总天数 |
| | | */ |
| | | public static Integer getDayOfYear(Integer year) { |
| | | return Integer.valueOf(LocalDate.of(year.intValue(), 1, 1).isLeapYear() ? 366 : 365); |
| | | return Integer.valueOf(LocalDate.of(year, 1, 1).isLeapYear() ? 366 : 365); |
| | | } |
| | | |
| | | /** |
| | | * 计算2个日期天数的差 endDate-startDate |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | public static Integer getDifference(LocalDate startDate, LocalDate endDate) { |
| | | Long l = Long.valueOf(endDate.toEpochDay() - startDate.toEpochDay()); |
| | | Long l = Long.valueOf(endDate.toEpochDay() - startDate.toEpochDay());//l.intValue() |
| | | Integer difference = Integer.valueOf(Integer.parseInt(l.toString())); |
| | | return difference; |
| | | } |