/** * @description: 判断两个日期是否在24之内 * @createDate: 2023-01-03 14:29:53 * @param startDate 起始日期 * @param endDate 结束日期 * @return boolean 返回true在24小时内 */ public boolean judgmentDate(Date startDate, Date endDate){ long cha = endDate.getTime() - startDate.getTime(); if (cha < 0) { return false; } double result = cha * 1.0 / (1000 * 60 * 60); if (result <= 24) { return true;//是小于等于 hour 小时 } else { return false; } }