香港服务器的mysql的日期为空怎么处理

已关闭留言

香港服务器的mysql的日期为空处理方法:若录入日期中小时超过了12个小时,应把%h修改为%H

具体实验案例如下所示:

select str_to_date(‘2016.08.22 13:46:12’, ‘%Y.%m.%d %h:%i:%s’); —输出空

select str_to_date(‘08.09.2008 08:09:30’, ‘%m.%d.%Y %h:%i:%s’); —输出‘2008-08-09 08:09:30’

处理方法:将第二句中的%h修改为%H后输出结果正常:

select str_to_date(‘2016.08.22 13:46:12’, ‘%Y.%m.%d %H:%i:%s’);