0

I'm trying to order items by date from Room database, where the dates are stored as strings with this format MMM dd yyyy. Is there any way I could do this without changing structure of my database?

I tried @Query("SELECT * FROM table ORDER BY date") which just orders the months alphabetically.

tony
  • 466
  • 6
  • 22

1 Answers1

2

I fixed my issue by changing my date format to from Jan 01 2019 to this format 2019 01, 01 and when retrieving from database, I order by the new date format.

NOTE: This might not be the best solution but it worked perfectly for what I'm trying to achieve.

tony
  • 466
  • 6
  • 22