I want to get posts of a specific date, I tried the following code but I did not get the result what I wanted.
<?php
$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'
");
WP QUERY
$posts = get_posts(array(
'post_type' => 'post',
'date' => $dt,
'posts_per_page' => 1
));
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 any way to get posts of a specific date?
$post_by_date
?