Hello everyone, such a question, I write time to the database in this way

I get time like this

Long tsLong = System.currentTimeMillis()/1000; String ts = tsLong.toString(); 

And then write down

 reference.child(id).child("time").setValue(ts); 

I'm trying to sort this way:

  reference = database.getReference("Object"); Long tsLong = System.currentTimeMillis()/1000; String ts = tsLong.toString(); query = reference.orderByChild("time").startAt("1552608000").endAt(ts); 

How can I ensure that the records are displayed in time from new to old?

PS while solving this issue, but it is not very suitable

 llm.setReverseLayout(true); llm.scrollToPosition(0); recyclerView.setLayoutManager(llm); 

    0