0
Hello, I have a variable in the database that contains the date in "dd/MM/yyyy" format, when I try to use the orderby of a query with that date firebase uses only the days (dd) to sort my recyclerView, making the query is not sorted efficiently, How can I get around this problem? There is no way to remove the "/" after they are in the database, as the method . orderby requires as parameter a field value that is in the database (existing there (22/04/1947)) and not a local value, I saw that it is possible to use Timestamp, but if I use timestamp, I would show my user "144546541", which is not anything readable...
Ordering example: anuncioRef.orderBy(campo, Query.Direction.ASCENDING).limit(100);
, where field is a value stored in the Database and that is not changed here, field here is the date value (dd/MM/yyyy)
You are storing your date in string format or using the data type?
– anonimo
Can’t change this string to another format in the database? example: "yyyyMMdd" or "yyyy-MM-dd" would be -"19470422" or "1947-04-22". In this format you could order.
– Murillo Comino
Storing as String, there is no way to store as date because of //
– luke cross
The problem is that if I change to this format, when displaying the ads I have to add the / manually, right?
– luke cross