As an alternative, you could use java.time
(since Java 8) and count the days between two dates:
public static void main(String[] args) {
// example String
String epoch = "1618991673000";
// parse it to a long
long epochMillis = Long.parseLong(epoch);
// then create an Instant from that long value
Instant instant = Instant.ofEpochMilli(epochMillis);
// and convert it to an OffsetDateTime at UTC (+00:00)
OffsetDateTime odt = OffsetDateTime.ofInstant(instant, ZoneOffset.UTC);
// get today's date (only, no time of day considered)
LocalDate today = LocalDate.now();
// and extract the date of the OffsetDateTime
LocalDate then = odt.toLocalDate();
// count the days between the two dates
long daysGone = ChronoUnit.DAYS.between(then, today);
// and print the result...
System.out.println("Days between " + then
+ " and today (" + today + "): " + daysGone);
}
This outputs (today, 21st of May 2021):
Days between 2021-04-21 and today (2021-05-21): 30
Afterwards, you can easily check if the amount of days is greater or less than allowed in your scenario.