计算当前时间到当天24点的毫秒
/*** 获取当天期剩余的毫秒数** @param currentDateTime {@code LocalDateTime} 当前日期时间* @return {@code long } 剩余毫秒数*/public static long getRemainSecondsOneDay(LocalDateTime currentDateTime) {//使用plusDays加传入的时间加1天,将时分秒设置成0LocalDateTime midnight = currentDateTime.plusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0);//使用ChronoUnit.SECONDS.between方法,传入两个LocalDateTime对象即可得到相差的秒数return ChronoUnit.SECONDS.between(currentDateTime, midnight);}
