I am trying to filter a date using Symfony 5 query builder. But the DateTime object has time in it and the query builder uses the time in the query too.
In my controller, I am catching the POST variables submitted through the form and storing them in an array to pass into my repository.
$criteria['date'] = \DateTime::createFromFormat('d/m/Y', $request->get('date'));
And in my repository, I am building the query as follows.
$qb->andWhere('quotation.date = :date');
$qb->setParameter('date', $criteria['date']);
The problem is the database table column has the data type datetime, so when filtering nothing comes up because the DateTime object created has a wrong time in it.
Is there a way to filter only using the date part in PHP or in the database?