How to get posts on a specific date – WP Query

I want to get posts of a specific date, I tried the following codes but I did not get the result what I wanted.

$mil = 1532996880000;
$seconds = $mil / 1000;
$dt = date(“Y-m-d”, $seconds);

$post_by_date = $wpdb->get_row(“SELECT * FROM {$wpdb->posts} WHERE post_date = $dt AND post_status = ‘publish'”);

This did not work because, the output of $dt = 2018-07-31, but the output shows no results. Because it compares with 2018-07-31 09:09:40. So is there anyway to get posts of a specific date ?

Read more here:: How to get posts on a specific date – WP Query

Leave a Reply

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