I have a weekly statistics system and I want to check if the latest statistics were updated last week. If that were the case, I want to clean it.
Currently, the date is stored in LocalDate:
LocalDate lastUpdate;
I already have daily statistics working as follows:
if(lastUpdate.isBefore(LocalDate.now())
{
clearDailyStatistics();
}
And I would like to do something like this:
if()
{
clearWeeklyStatistics();
}
So the question is: how to compare weeks of objects LocalDate? There is no need for different "standards" of how the week is formed - from Monday to Sunday (as it is already used by the Java class DayOfWeek).
Please leave your comments and answers only about Java 8 java.time classes, no Joda-Time or other external libraries.