java8方式日期比较
static ZoneId ZONEID_BJ = ZoneId.of("GMT+08:00");
private boolean sameDate(Date d1, Date d2){ try { return ZonedDateTime.ofInstant(d1.toInstant(), ZONEID_BJ).toLocalDate().isEqual( ZonedDateTime.ofInstant( d2.toInstant(), ZONEID_BJ) .toLocalDate()); } catch (Exception e) { return false; } } private boolean compareDate(Date d1, Date d2){ try { return ZonedDateTime.ofInstant(d1.toInstant(), ZONEID_BJ).toLocalDate().isAfter( ZonedDateTime.ofInstant( d2.toInstant(), ZONEID_BJ) .toLocalDate()); } catch (Exception e) { return false; } }