java.time
You can make use of java.time classes built into Java 8 and later to check if a certain date lies within last 10 days.
First: convert lastdate (that you already have) to LocalDate.
Instant instant = Instant.ofEpochMilli(lastdate) ; // A moment in UTC.
LocalDate originalDate = instant.atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate tenDaysOldDate= LocalDate.now().minusDays(10); //10 days old date
if (Period.between(tenDaysOldDate, originalDate ).getDays() > 10)
//greater than 10 days
LocalDate is immutable and thread-safe. This class should be preferred over the problematic Date class.
Period is also immutable and thread-safe. It measures time in years, months and days.
Most of the java.time functionality is back-ported to Java 6 & Java 7 in the ThreeTen-Backport project. Further adapted for earlier Android in the ThreeTenABP project. See How to use ThreeTenABP….