I am developing kind of event organising app. So, I am saving the startTime, startdate, endTime and endDate of the event in FirebaseDatabase
in following format: hh:mm:ss
and dd-MM-yyyy
respectively.
I'm saving under this reference:
mDatabase = FirebaseDatabase.getInstance().getReferenceFromUrl("https://example-113be.firebaseio.com/events/")
mDatabase.child(itemID).setValue(events);
where itemID
is push key retrieved using this code: itemID = mDatabase.push().getKey();
The problem: So, what I'm trying to do is I'm trying to filter the data based on the startTime and startDate in 2 categories - "Live events" and "events scheduled for later". Like if startTime of event is less than current time of device, it means the event has already started and should be showed under "live event" category and if the startTime is greater than current time, it means the event hasn"t been started yet and should be shown under "scheduled for later" category.
What I want: is to retrieve the data is such a manner that above described problem should be solved. Please let me know how to.
Please tell me if I need to restructure the way I'm saving data and should I need to store something else along with all the data.