List.view sorting: ascending by "hour" and descending by "date"

Hi guys!
I need your help!
I have a list of elements, this list contains values with this format:

14-04-2023~13:30-S:(uid.value)-(name.value)
14-04-2023~06:10-S:(uid.value)-(name.value)
07-05-2023~22:00-S:(uid.value)-(name.value)
14-04-2023~19:45-S:(uid.value)-(name.value)

So i have: DATE~TIME
Any idea of how i can sort this list by “who comes first compared to clock.now”?
So I want a list like this:

Today: 27-02-2023~13:30

14-04-2023~06:10-S:(uid.value)-(name.value)
14-04-2023~13:30-S:(uid.value)-(name.value)
14-04-2023~19:45-S:(uid.value)-(name.value)
07-05-2023~22:00-S:(uid.value)-(name.value)

Thank you in advance!

Instead of saving date-time method it is prefer to save with millis(date time to milli) so you can easily sort it any order

1 Like

The main problem here is that I’m saving these values on Firebase so this format is more readable for me as “admin of database” and these values will be shown in app as “readable data”. This way the application is doing less operations because it doesn’t have to transform from mills to readable date~time.

But I could save data with this format from database into a variable, then I could transform to mills, sort, then transform again into readable date~time? This way seems very heavy but i can read values from database too…
Or… do you have any suggestion? :smiley:

Ok! managed to find the solution!
Unfortunately I don’t like the amount of operations my app has to do to achieve this result but it’s the best solution for my problem!

In case anybody would need this solution in future, here it is:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.