MySQL DATE_FORMAT inverse?

I am using the MySQL DATE_FORMAT function to get the date in the format I need.

SELECT DATE_FORMAT(`dob`, '%m-%d-%Y' ) as dob FROM `tblUsersProfile` WHERE `user_id` = 1

But now I want to update the date from this format to the default mysql date format?

I know how to do this in php, but I'm trying to change the format in MySQL. Somebody knows?

+5
source share
1 answer

Do you want MySQL STR_TO_DATE():

UPDATE tblUsersProfile SET `dob` = STR_TO_DATE('1-2-2011', '%m-%d-%Y') WHERE user_id = 1;
+5
source

All Articles