I want to get the milliseconds truncated to days, I can use
Instant.now().truncatedTo(ChronoUnit.DAYS).toEpochMilli()
But I can't truncate to ChronoUnit.MONTH
(it throws an exception). Do I need use a Calendar?
This is what java.time.temporal.TemporalAdjusters
are for.
date.with(TemporalAdjusters.firstDayOfMonth()).truncatedTo(ChronoUnit.DAYS);