MySQL update text field to date field
Posted on 2014-01-02
I have a database where the date field is text field and need to fix that. What is the best way to do that.
If date1 is a text field with 01/01/2014
and date 2 is a date field and needs to display 2014-01-01.
Would you use substr to get the numbers out, something like this conceptually, if so, I have no idea how to put them all together?
update table set date2 = date_format('substr(`date1`, 0, 2)', '%Y-%m-%d')
Thanks in advance, hope everyone had a great new year!