Shortest answer, given your timezone being TZ
:
LocalDateTime start = LocalDate.now(TZ).atStartOfDay()
LocalDateTime end = start.plusDays(1)
Compare using isAfter()
and isBefore()
methods, or convert it using toEpochSecond()
or toInstant()
methods.