我似乎无法正确使用str_to_date。我试着这个:
$test = "Fri May 01 2015 00:00:00";
$sql = "SELECT * FROM ax_timestamps WHERE str_to_date('$test', '%D %M %d %Y %H:%i:%s') < datetimefeild ORDER BY id ASC";
但它没有从数据库中提取它应该的数据。
例如,数据库有一个日期时间字段,该字段应该已被提取:
2015-05-16 07:44:56
答案 0 :(得分:0)
试试这个:
$sql = "SELECT * FROM `ax_timestamps` WHERE str_to_date($test, '%D %M %d %Y %H:%i:%s') < `datetimefeild` ORDER BY `id` ASC";
答案 1 :(得分:0)
由于某些原因,它不是它的%D值,修剪后一切都按预期工作。
$test = "May 01 2015 00:00:00";
$sql = "SELECT * FROM ax_timestamps WHERE str_to_date('$test', '%M %d %Y %H:%i:%s') < datetimefeild ORDER BY id ASC";