change varchar to DATE in PHPMyAdmin

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jonnyfortis
Forum Contributor
Posts: 462
Joined: Tue Jan 10, 2012 6:05 am

change varchar to DATE in PHPMyAdmin

Post 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
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: change varchar to DATE in PHPMyAdmin

Post by Celauran »

Backup your table beforehand.

Code: Select all

ALTER TABLE foo MODIFY somecolumn DATE
Or DATETIME if that's what you need.
jonnyfortis
Forum Contributor
Posts: 462
Joined: Tue Jan 10, 2012 6:05 am

Re: change varchar to DATE in PHPMyAdmin

Post 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
Post Reply