0

我有一个日期字段ref_event_timesend_date和一个时间场ref_event_timesend_time在我的表“ref_event_times”中......

我尝试将其合并为一个日期时间字段“end_date_time”...使用follow

STR_TO_DATE('CONCAT(`ref_event_times`.`end_date`,' ',`ref_event_times`.`end_time`)','%m/%d/%Y %H:%i') AS `end_date_time`

返回空...

错误在哪里?

4

1 回答 1

0

MYSQL 不支持您给定的日期时间格式'%m/%d/%Y %H:%i'

mysql日期格式应该是'%Y-%m-%d %H:%i:%s' mysql中的这个日期时间格式

    Data Type   “Zero” Value
    DATE        '0000-00-00'
    TIME        '00:00:00'
    DATETIME    '0000-00-00 00:00:00'
    TIMESTAMP   '0000-00-00 00:00:00'
    YEAR        0000

试试这个例子

select STR_TO_DATE(CONCAT(current_date,' ',current_time),'%Y-%m-%d %H:%i:%s');
于 2016-09-16T12:15:50.910 回答