mzurita
mzurita

Reputation: 690

Change format date (varchar) in SQLite table

I have a big table in SQLite with a field for dates (varchar type) with a following format dd-mm-yyyy hh:mm (i.e. 01-01-2014 01:20) and I need to transform them into the following format dd-mm-yyyy, hh:mm (adding a comma after year i.e. 01-01-2014, 01:20)

How can I do this? Does it exist any way with date formatter or using regexp in SQLite?

Upvotes: 0

Views: 121

Answers (1)

CL.
CL.

Reputation: 180020

You simply want to insert something after the tenth character. Use the substr function for this:

UPDATE BigTable SET AField = substr(AField, 1, 10) || ',' || substr(AField, 11)

Upvotes: 1

Related Questions