/**
* 获取日期月日的时间差
*
* @param date
*
* @param dateStr 格式YYYY-MM-dd
*
* @return 时间差单位(天)
*/
public static Integer getDateTimeBetween(Date date,String dateStr){
if(Objects.isNull(date) || StringUtils.isBlank(dateStr)){
return null;
}
DateFormat df = new SimpleDateFormat("yyyy");
String currentYear = df.format(date);
String birthDay = currentYear + dateStr.substring(4)+" 00:00:00";
LocalDateTime localDateBirthDay = LocalDateTime.parse(birthDay, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
Instant instant = date.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime currentDateTime = instant.atZone(zoneId).toLocalDateTime().withHour(0).withMinute(0).withSecond(0).withNano(0);
Duration duration = Duration.between(localDateBirthDay, currentDateTime);
return (int)duration.toDays();
}