select STR_TO_DATE('20120801', 'YYYYMMDD');
+-------------------------------------+
| STR_TO_DATE('20120801', 'YYYYMMDD') |
+-------------------------------------+
| NULL |
+-------------------------------------+
1 row in set, 1 warning (0.00 sec)
Warning (Code 1411): Incorrect datetime value: '20120801' for function str_to_date
我没有关注字符串日期或日期格式YYYYMMDD中出现的语法错误?