1

I have column with strings of dates with format: "dd.mm.yyyy". I need to convert the date format contained in the strings to ISO8601 format: "YYYY-MM-DD" for the whole column.

  • I have column with strings of dates Does this mean the field is defined as varchar? If so use strftime() function for to parse datetime using your current format. – Akina Jan 11 at 11:50
  • I use data type TEXT to store dates (in SQLite). I think it looks like a data type varchar. – Denis Jan 11 at 12:07
  • if so strftime() must solve your problem. – Akina Jan 11 at 12:08
0

String manipulation seems to way to go here:

UPDATE myTable
  SET myDate = SUBSTR(myDate, 7, 4)
     || '-' || SUBSTR(myDate, 4, 2)
     || '-' || SUBSTR(myDate, 1, 2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.