我如何获得今天到期日并将于明天结束的产品?

时间:2018-03-07 06:16:16

标签: wordpress post select

我如何获得今天到期日并将于明天结束的产品?

在此查询

$current_date = date('d/m/y/'); 
$future_date = strtotime($current_date, "+ 1 day");
$today_date = strtotime($current_date);

$sql = "SELECT distinct wposts.*
                FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
                WHERE wposts.ID = wpostmeta.post_id
                AND wposts.post_status = 'publish'
                AND wposts.post_type = 'products'
                AND  wpostmeta.meta_value =$today_date AND 
                wpostmeta.meta_value <=$future_date
                ORDER BY wposts.post_date DESC";
wpostmeta.meta_value表中的

1520380800, 07/03/18

数据库

enter image description here

0 个答案:

没有答案