我在prestashop 1.7中进行此sql查询,但日期间隔不起作用。
我的代码是:
$todays =date("Y-m-d");
$t_days=date('Y-m-d', strtotime('-30 days'));
$id_clientee=$this->context->customer->id;
$spent_month = Db::getInstance()->getValue(
'SELECT SUM(total_paid_real) AS sum FROM ' . _DB_PREFIX_ . 'orders WHERE
date_add BETWEEN "'.pSQL($t_days).' 00:00:00" AND "'.pSQL($todays).' 23:59:59"
AND id_customer = ' . (int)$id_clientee . '
AND (current_state = 5 or current_state = 4 )
');
$spesaaaa=(int)$spent_month;
DB上的 date_add
格式为:2017-05-29 13:33:13 Type: datetime
为什么“ date_add1间隔不起作用?”