I'm writing an application which is based on javafx/hibernate. Now i have problem when i want to make new table with articles that are sold last 7/30/365 days (or custom date chosen).
- articles are stored in database with current date (
Date articleDate = new Date();) - all articles are fetched from database when the program is started and they are in an 
ObserveListnamedarticlesDBList. 
What i have tried so far:
ObserveList<ArticlesDB> sortForSevenDays =FXCollections.observableArrayList(); 
for(ArticleDB article: articleDBList) {
    if() { //missing statement for comparing articles by date for past 7 days
        sortForSevenDays.add(article);
    }
}  
				
                        
On mkyong there are 3 possibilities in comparing
Datein Java. In the comment section even the better choice (IF Javaversion < 8) of Joda-Time is presented.The simpliest Solution without Joda would probably be just to compare using
Calendar:INFO: Just keep in mind, that this compares for exactly 7 days (incl. minutes etc.).