title: Query over a DateTime field ignoring hours and minutes
body: <p>I am writing a PHP site, in which I use some Mysql to access a DB.</p>
  
  <p>I have a table named <code>travel</code>, which used to have a field named <code>date</code> from type Date (according to phpMyAdmin), and also I have a PHP variable <code>$date</code> from type string which stores a date in the format <code>"Y-m-d"</code></p>
  
  <p>when I needed to get all the elements from the table where the date was the same as the specified in <code>$date</code>, I was able to do it with a simple query like this:</p>
  
  <p><code>"SELECT * FROM travel WHERE date=$date"</code></p>
  
  <p>Now the problem is, I needed to change the date field data-type on the DB, from Date to DateTime, to also store hours and minutes. </p>
  
  <p>On this particular query I am not interested on hours and minutes. I just need to get all the elements from the table where the date is the same as the specified in <code>$date</code> <strong>without considering the hours and minutes</strong> stored in the DB field. </p>
  
  <p>what i am suposed to change to achieve this?</p>
  
  <p>For example:</p>
  
  <p>$date = "2030-12-25"</p>
  
  <p>and</p>
  
  <p>database</p>
  
  <pre><code>    ID (int)        date (DateTime)
      1           1994-05-30 12:25:00
      2           2030-12-25 15.20:00
      3           2030-12-25 10:30:00
  </code></pre>
  
  <p>I need to get elements with ID 2 and 3.</p>
  
  <p>PS: I know there are similar questions to this, but none of them were useful to me for different reasons</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>The mistake that was preventing me to make this query work properly was also present on the old implementation without the time part.</p>
  
  <p>I was omitting single quotes on the $date variable, and it caused the DBMS to not identify the date as a string.</p>
  
  <p>old query: </p>
  
  <p><strike> <code>"SELECT * FROM travel WHERE date=$date"</code> </strike></p>
  
  <p><code>"SELECT * FROM travel WHERE date='$date'"</code> fixed adding single quotes on <code>$date</code></p>
  
  <p>Also as KIKO Software answered the new one should include quotes too: </p>
  
  <p><code>"SELECT * FROM travel WHERE DATE(date) = '$date';"</code></p>