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-代表两位

posted @ 2015-12-22 18:32  Lio5n  阅读(299)  评论(0编辑  收藏  举报