Reputation: 36
I wanted to query object within December but it return with Jan-Nov object. This is my query.
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.MONTH, 0);
Date date = calendar.getTime();
Log.d("date", String.valueOf(date));
ParseQuery<ParseObject> query = ParseQuery.getQuery("Post");
query.whereGreaterThanOrEqualTo("createdAt", date);
query.count();
List<ParseObject> results = null;
results.size(); //this count include the whole year value
Upvotes: 0
Views: 347
Reputation: 126
First of all try this :
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 0);
calendar.set(Calendar.MONTH, 0);
You need to fetch all data for just 1 year ( Year start Jan 1 and end Dec 31 ) and not more.And maybe that's the reason it stack there.
Also you don't need than line of code :
Date date = calendar.getTime();
Try just this :
query.whereGreaterThanOrEqualTo("createdAt", calendar.getTime());
I hope it help you.
Upvotes: 1