mysql 时间格式转换

来源:互联网 发布:孝庸资产知乎 编辑:程序博客网 时间:2024/05/16 16:00

 

 

 

sql:

select Date_Format(if (str_to_date('08/14/2008', '%m/%d/%Y %r') is null, if (
str_to_date('08/14/2008', '%Y-%m-%d') is null, str_to_date('08/14/2008',
 '%c/%e/%Y %T'), str_to_date('08/14/2008', '%Y-%m-%d')), str_to_date(
 '08/14/2008', '%m/%d/%Y %r')), '%Y-%m-%d') as tr_date