Getting page posts using the fetchConnection API ("page_id/posts") is not trivial when you want to restrict it by start and end time.. the best way to do so is by using fql query. something along the lines of below code snippet works.
String query = "select post_id, created_time from stream where "
+ "source_id = " + pageId + " and created_time > "
+ startTimeInSec + " and created_time < " + endTimeInSec
+ " limit 500";
FacebookClient fbClient = new DefaultFacebookClient(accessToken);
List<FqlPost> fqlPosts = fbClient.executeFqlQuery(query, FqlPost.class);
for (FqlPost pagePost : fqlPosts) {
System.out.println(pagePost);
}
public static class FqlPost {
@Facebook("post_id")
String post_id;
@Facebook("created_time")
String created_time;
@Override
public String toString() {
return String.format("%s,%s", post_id, created_time);
}
}