how do i get products where expiring date today and will end tomorrow?

enter image description here

how do I get products where expiring date today and will end tomorrow?

Query Here

$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";

value in wpostmeta.meta_value table

1520380800, 07/03/18

Database

Read more here:: how do i get products where expiring date today and will end tomorrow?

Leave a Reply

Your email address will not be published. Required fields are marked *