I have a large set of data with a varchar column which contains an unusual date time format.
How can I both convert the data in the 6000+ rows, and then convert the column's type?
I can see that it's possible to convert the type with this:
ALTER TABLE MODIFY date time;
But I don't see how I can keep the data and do this for all rows at the same time.
An example date that I currently have is:
Mon, 23 Sep 2013 07:01:00 GMT
Answer as per @Mihai
UPDATE rns
SET rns.`rns_pub_date` = STR_TO_DATE(rns_pub_date,"%a, %d %b %Y")
解决方案
UPDATE `table`
SET `column` = STR_TO_DATE(`column`,'%Y-%m-%d')
Adapt the format to your needs.