Page 1 of 1

change varchar to DATE in PHPMyAdmin

Posted: Tue Jan 20, 2015 3:18 am
by jonnyfortis
bit of an issue, I have a database that is already populated one of the columns is a varchar but storing dates DD/MM/YY

is there a way to change this the date all at once and change the format to the correct formatting 0000-00-00

thanks

Re: change varchar to DATE in PHPMyAdmin

Posted: Tue Jan 20, 2015 6:13 am
by Celauran
Backup your table beforehand.

Code: Select all

ALTER TABLE foo MODIFY somecolumn DATE
Or DATETIME if that's what you need.

Re: change varchar to DATE in PHPMyAdmin

Posted: Tue Jan 20, 2015 7:19 am
by jonnyfortis
Celauran wrote:Backup your table beforehand.

Code: Select all

ALTER TABLE foo MODIFY somecolumn DATE
Or DATETIME if that's what you need.
great thanks