I am making an adroid application. I am saving sales data on firebase with current date. I have formatted the System.currentTimeMillis() into SimpleDateFormat. The date is successfully stored on firebase . Now I want to retrieve sales between two dates. I made two demo sales, one on (30-5-2019) and second on (31-5-2019).
For retrieving the sales data I have just put two above mentioned static dates in my Query and ran it . The problem is that it only gives me one sale record between two dates. It should give me 2 sale records.

Below is my source code.

// Firebase Query
Query Qdates = sales_ref.orderByChild("date").startAt("30-5-2019").endAt("31-5-2019");
        Qdates.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                for (DataSnapshot ssn : dataSnapshot.getChildren()) {

                     Sale sale = ssn.getValue(Sale.class);
                     String id =sale.getId();
                     Toast.makeText(getActivity(),id,Toast.LENGTH_LONG).show();
                     String customerName = sale.getShippingInfo().getFirstname()+""+sale.getShippingInfo().getLastnme();
                     String countryName = sale.getShippingInfo().getCountry();
                     int itemscount = sale.getList().size();

                     SalesListItem salesListItem = new SalesListItem(id,customerName,countryName,itemscount);
                     alSalesListItem.add(salesListItem);
                     }
                final CustomAdapter customadapter = new CustomAdapter();
                lv.setAdapter(customadapter);
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        }) ;

The output should be 2 sales i-e with following IDs;
Lg6SwzRLbYg4fMDs4H6 (this sales is made on 30-5-2019)
Lg8N1n40zMBVq6V_1hL (this sales is made on 31-5-2019)

But I am getting only one sale that is (this sales is made on 30-5-2019)

Why I am not getting both sales? Please see the attached image.

firebase.PNG

I don't know firebase, but as nobobdy else has answered....

MAYBE there's a time attached to that data, eg
30-5-2019 10am
31-5-2019 11am
and your query is defaulting to midnight, ie 30-5-2019 00:00 to 31-5-2019 00:00
???

If so the fix is to end the date range with a date one day later.

commented: Thanks for trying James. Actually there was need to convert the string date in date object, I did so and the problem solved +3
commented: The more I thought about your reply the more likely that's it. +15