I need to get all documents within the specified date/time range (all within the same day from 00:00:00 to 23:59:59)
Ive tried multiple querys, and there is nothing in the docs about querying the same date with different times. Most examples show a specific date/time, but I need the query to be all documents scheduled for today(dynamic)
private void loadList() {
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
Date todayStart = c.getTime();
c.set(Calendar.HOUR_OF_DAY, 23);
c.set(Calendar.MINUTE, 59);
c.set(Calendar.SECOND, 59);
Date todayEnd = c.getTime();
Log.d(TAG, "this is the date/time for todayStart" + todayStart);
Log.d(TAG, "this is the date/time for todayEnd" + todayEnd);
mFirestoreDB.collection("events")
.whereGreaterThanOrEqualTo("dateScheduled", todayStart)
.whereLessThanOrEqualTo("dateScheduled", todayEnd)
.get()
.addOnCompleteListener(task -> {
if (task.isSuccessful()) {... ect
Example Firestore field: dateScheduled May 5, 2019 at 12:00:00 AM UTC-4
Example 2:
The Log.d is showing correct date/times for today, and I have many documents that have the todays date scheduled. This should return all documents with any time frame for todays date. Any help is appreciated!