Level 26
?
$complains = DB::table('complains')->where('created_at', 'like', '2015-08-20%')->get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a table complains where created_at is a timestamp field. Now to get all the complaints received in a particular day, I need to compare date with the created_at field(datetime). To achieve this I wrote :
if(isset($_GET['date']) && $_GET['date'] != '') {
$date = date('Y-m-d', strtotime($_GET['date']));
$matchThese[DATE('complains.created_at')] = $date;
}
But when I run the query, It shows an error with trying to compare
`2015-08-07T16:03:59+05:30201508pFridaypm03859`.`2015-08-07T16:03:59+05:30Fri, 07 Aug 2015 16:03:59 +0530Asia/Kolkatapm31Asia/Kolkata07_pm31` = 2015-08-20
Please or to participate in this conversation.