Searching for a period or in general by time is done by the server only if you use IMAP to connect. Example:
SearchTerm term = null;
Calendar cal = null;
cal = Calendar.getInstance();
Date minDate = new Date(cal.getTimeInMillis()); //get today date
cal.add(Calendar.DAY_OF_MONTH, 1); //add 1 day
Date maxDate = new Date(cal.getTimeInMillis()); //get tomorrow date
ReceivedDateTerm minDateTerm = new ReceivedDateTerm(ComparisonTerm.GE, minDate);
ReceivedDateTerm maxDateTerm = new ReceivedDateTerm(ComparisonTerm.LE, maxDate);
term = new AndTerm(term, minDateTerm); //concat the search terms
term = new AndTerm(term, maxDateTerm);
Message messages[] = folderInbox.search(term); //search on the imap server
If you instead of IMAP use POP3, I guess your only choice is to filter (on the client) on the entire list of messages that you fetched from the server, iterating over it, like @user2310289 was telling you:
for (Message message : messages) {
if (message.getSentDate().after(minDate) && message.getSentDate().before(maxDate))
{
//do whatever you want with your filtered by period message
}
}
I hope I helped you.