繁华开满天机
将Instant(time-since-Epoch) 与 a进行比较时LocalDateTime,您始终需要考虑当地时间的时区。下面是一个例子:Instant now = Instant.now();LocalDateTime start = LocalDateTime.of(2018, 7, 24, 0, 0);LocalDateTime end = LocalDateTime.of(2018, 7, 24, 23, 59);final ZoneId myLocalZone = ZoneId.of("Europe/Paris");if (now.isAfter(start.atZone(myLocalZone).toInstant()) && now.isBefore(end.atZone(myLocalZone).toInstant())) { // the instant is between the local date-times}