android - SQLite query to update some (not all) date formats -
In my database, there is currently a column that looks like this:
id | Timestamp - | --------- 1 | 07/29/2014 2 | 07/30/2014 3 | 07/30/2014 4 2014-07-30 5 | 2014-07-30
I am trying to format any lines of timestamp in the old format, in the new format
In this example, 1- 3 rows are needed to improve
07/29/2014 -> 2014-07-29 07/30/2014 - & gt; 2014-07-30 07/30/2014 - & gt; 2014-07-30
I am not familiar with SQL / SQLite but to come up with some SQL I can execute once to see if anyone in the old format There are rows,
I believe I am trying to do what this user wrote here, but this was not possible. Do not get it to work
Thank you!
Here are the results of getting some real data:
timestamp column old / timestamp converted 07/25/2014 - & gt; 01/04/0031 05/21/2014 - & gt; 11/04/0026 01/25/2013 - & gt; 07/06/0030 09/25/2000 - & gt; 02/21/0031 07/25/2015 - & gt; 01/05/0031 07/25/2016 - & gt; 01/06/0031 07/25/1999 - & gt; 12/20/0030 07/25/1986 - & gt; 12/07/0030
and using the method here
// reformatDates publicly without correction dates (string table) {SQLiteDatabase Db = this .getWritableDatabase (); String selectQuery = "SELECT * FROM" + Table; Cursor cursor = db.rawQuery (selectQuery, zero); Cursor.moveToFirst (); If (! Cursor.isfestest ()) {do {db.execSQL ("Food Set Timestamp = Update Substitutes (Timestamp, 4.2) || '-' || Substrate (Timestamp, 1,2) || '- 'Substrost (timestamp, 7) where timestamp'% /% '"); } While (cursor.movetoonext ()); } Cursor.close (); Db.close (); }
found this time!
Comments
Post a Comment