public static void main(String[] args) {
long ts = 1615797812000L;
LocalDateTime time = LocalDateTime.ofInstant(Instant.ofEpochMilli(ts), ZoneOffset.ofHours(8));
long l = time.truncatedTo(ChronoUnit.MINUTES).toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
System.out.println(l);
l = time.truncatedTo(ChronoUnit.HOURS).toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
System.out.println(l);
l = time.truncatedTo(ChronoUnit.DAYS).toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
System.out.println(l);
l = time.truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1).toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
System.out.println(l);
l = time.truncatedTo(ChronoUnit.DAYS).withDayOfYear(1).toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
System.out.println(l);
}