My site was built with WordPress and I have the following case:
The table I want to query is the wp_posts
and the column to be targeted is the post_date
which is of the time Datetime
(not Date
and I cant change it because of WordPress's convenience).
How want to fire a sql query that will give me all the details about an event posted on a specific date that will come from a calendar.
I tried this:
$date = new DateTime(2019-07-03);
$date_format = $date->format("Y-m-d");
$request = $pdo->query("SELECT * FROM posts WHERE post_date = ".$date_format);
$result = $request->fetch()
If I var_dump()
the $dateformat
I can see the data, however, my $result
shows nothing.
I then concluded that it will never show anything because in table, the dates also have times.
So, how can I get those details if I only have year, month, day, and not the hours?