Android Question [Solved] Change date format DD/MM/YYYY to YYYY-MM-DD in SQLite

asales

Expert
Licensed User
Longtime User
I have a table with date stored in format DD/MM/YYYY and I need to update this table, modifying the date field to YYYY-MM-DD format (default of SQLite).

I need to create a sub to change the field content, one by one, or I can use the SQL statement?

I tried this SQL statement, but don't works correctly. It changes the content of all field to the date stored in first record:

B4X:
UPDATE [myTable] SET mydate = (SELECT substr(mydate, 7, 4)||'-'||substr(mydate, 4,2)||'-'||substr(mydate, 1,2) from myTable)
What I'm missing?

Thanks in advance for any tip.
 
Top