How to obtain the start time and end time of a day?
code like this is not accurate:
private Date getStartOfDay(Date date) { Calendar calendar =
I tried this code and it works well!
final ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC); final ZonedDateTime startofDay = now.toLocalDate().atStartOfDay(ZoneOffset.UTC); final ZonedDateTime endOfDay = now.toLocalDate().atTime(LocalTime.MAX).atZone(ZoneOffset.UTC);