STR_TO_DATE
str_to_date
Convert A String To A Date Value In MySQL
Tue, 04/21/2009 - 13:49 | by philipnorton42There are numerous ways to print out dates and times, and many hours of programming are spent in converting dates from one format to another.
To do this in MySQL you use the STR_TO_DATE() function, which has two parameters. The first parameter is the time to be parsed and the second is the format of that time. Here is a simple example that converts one date format to a MySQL formatted date string.
SELECT STR_TO_DATE('[21/Apr/2009:07:14:50 +0100]', '[%d/%b/%Y:%H:%i:%S +0100]');
This outputs 2009-04-21 07:14:50.