Reputation: 587
$em = $this->getEntityManager();
$query = $em->createQuery(
"SELECT b
FROM AppBundle:Booking b
AND b.checkin IS NULL
AND b.bookingDate=CURRENT_DATE()"
);
I want to see the booking of today, but also i want to have the time of booking in bookindDate. So how to comparison datetime bookingDate with CURRENT_DATE() ?
Upvotes: 2
Views: 3542
Reputation: 587
$em = $this->getEntityManager();
$query = $em->createQuery(
"SELECT b
FROM AppBundle:Booking b
AND b.checkin IS NULL
AND b.bookingDate >= CURRENT_DATE()
AND b.bookingDate <= CURRENT_DATE()+1"
);
this work for me, too easy ;)
Upvotes: 0
Reputation: 117
yo can use
$date = new DateTime();
$em = $this->getEntityManager();
$query = $em->createQuery(
"SELECT b
FROM AppBundle:Booking b
AND b.checkin IS NULL
AND b.bookingDate=". $date->format('Y-m-d')
);
Upvotes: 0