sqlite convert 'dd.MM.yyyy' formated String to date

前端 未结 3 1573
情话喂你
情话喂你 2020-12-30 17:05

i have a sqlite database on my android, whith a datetime column, that contains a date with the Format dd.MM.yyyy. It\'s not my Database, I\'m niot able to change the Datefor

3条回答
  •  心在旅途
    2020-12-30 17:32

    Try this query to change the column to the proper format for a text-date (assume table named table and column named date):

    update table set date = substr(date, 7) || "-" || substr(date,4,2) 
      || "-" || substr(date, 1,2);
    

    You can also turn this around into a where clause per this answer.

提交回复
热议问题