mysql将字符串转换为表名,将字符串/ varchar转换为MySQL表之间的日期

I have a large PHP project that I've been working on for my own business.

I have a MySQL table, with about 2600 entries, that I'd like to "fix" the dates in. My current table has 3 VARCHAR columns that contain string dates. I'd like to convert these, into a duplicate table, but change them to type DATE on the way.

Once I make the conversion and everything looks good, I will copy the new table to the old database, and only allow a date picker to enter those dates on a going-forward basis.

Most of the existing string dates are on the format mm-dd-yyyy, example: 05-03-2013. Some are mm/dd/yyyy, example: 05/03/2013, and a few are of the MONTH DAY, YEAR format, example: March 26th, 2013.

What I ultimately want is them to be of the yyyy-mm-dd format, example: 2013-05-02.

I think I can do this using PHP, passing each string date through strtotime()

你可能感兴趣的:(mysql将字符串转换为表名)