MySQL字符串转日期

select str_to_date('2008-4-2 15:3:28','%Y-%m-%d %H:%i:%s');

select str_to_date('2008-08-09 08:9:30', '%Y-%m-%d %h:%i:%s');

select str_to_date('20151222', '%Y%m%d');

select str_to_date('20151222', '%y%y%m%d');

注意:%Y-代表4位,%y-代表两位

原文地址:https://www.cnblogs.com/wanggs/p/5067740.html