这已经被问了很多,但我发现的答案似乎不起作用,所以我在这里发帖看看是否有人可以提供帮助。
我有这个
$sql = "SELECT SQL_CALC_FOUND_ROWS *, UNIX_TIMESTAMP(order_date) AS order_date, UNIX_TIMESTAMP(order_expected) AS order_expected
FROM orders WHERE DATE(order_expected) BETWEEN NOW() AND DATE_ADD(NOW() - INTERVAL 7 DAY);
或者
$sql = "SELECT SQL_CALC_FOUND_ROWS *, UNIX_TIMESTAMP(order_date) AS order_date, UNIX_TIMESTAMP(order_expected) AS order_expected
FROM orders WHERE DATE(order_expected) BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL -7 DAY);
所有字段的名称都是正确的,但似乎都无法在今天之前的 7 天内获得日期的值。
请帮忙。
伊恩