import java.time.*;
class Main {
public static void main
(String[] args
) { // A sample epoch
long epoch = 1693832142L;
// Note: change the timezone as per your requirement
ZoneId userZone = ZoneId.of("America/New_York");
// ZonedDateTime at the given epoch
ZonedDateTime zdtGiven = Instant.ofEpochSecond(epoch).atZone(userZone);
// LocalDate at the given epoch
LocalDate localDateGiven = zdtGiven.toLocalDate();
// Today
LocalDate today = LocalDate.now(userZone);
// Get start of today
ZonedDateTime startOfToday = today.atStartOfDay(userZone);
// Get start of the next day
ZonedDateTime startOfNextDay = today.plusDays(1).atStartOfDay(userZone);
// Current ZonedDateTime
ZonedDateTime zdtNow = ZonedDateTime.now(userZone);
// Anything happening before a given time e.g. 10 am today
if (zdtGiven.isAfter(startOfToday) && zdtGiven.isBefore(zdtNow.with(LocalTime.of(10, 0))))
// Do this e.g.
System.
out.
println("Before 10 am today");
// Alternatively
if (localDateGiven.isEqual(today) && zdtGiven.isBefore(zdtNow.with(LocalTime.of(10, 0))))
// Do this e.g.
System.
out.
println("Before 10 am today");
// Anything happening after a given time e.g. 10 am today
if (zdtGiven.isAfter(zdtNow.with(LocalTime.of(10, 0))) && zdtGiven.isBefore(startOfNextDay))
// Do this e.g.
System.
out.
println("After 10 am today");
// Alternatively
if (zdtGiven.isAfter(zdtNow.with(LocalTime.of(10, 0))) && localDateGiven.isEqual(today))
// Do this e.g.
System.
out.
println("After 10 am today");
// Anything happening today
if (localDateGiven.isEqual(today))
// Do this e.g.
}
}