In mysql database
The internal function STR_TO_DATE(str,format) can be used to realize the conversion of string date format
mysql> select STR_TO_DATE('20100211','%Y%m%d %H:%i:%s') as result;
+---------------------+
| result |
+---------------------+
| 2010-02-11 00:00:00 |
+---------------------+
mysql> select STR_TO_DATE('20100211 12:12:12','%Y%m%d') as result;
+------------+
| result |
+------------+
| 2010-02-11 |
+------------+
More sharing VX: data guide