title: Using MySql DATE function in CakePHP 3 query where clause
body: <p>Objective: Trying to get all posts on a certain date from the db table(say, I've datetime in the format '2019-03-07 12:30:00' then  I would like to get all posts from this date '2019-03-07').</p>
  
  <p>As I need posts from this date, I'm converting the given datetime to i18nFormat date format. As below ::</p>
  
  <pre><code> $userSelectedDate = $selectedDate-&gt;i18nFormat('yyyy-MM-dd');
  </code></pre>
  
  <p>then, On the where clause, I'm using <a href="https://www.w3schools.com/sql/func_mysql_date.asp" rel="nofollow noreferrer">mySql DATE function</a> on table field and it returns me expected result. code as below: </p>
  
  <pre><code>    $conn = connectionManager::get('default');
      $conn-&gt;begin();
      $stmt = $conn-&gt;prepare(
          "SELECT * FROM `blogs`
              where DATE(`PUBLISHED_DATE`) = '$userSelectedDate'"
      );
  
      $stmt-&gt;execute();
      $conn-&gt;commit();
  </code></pre>
  
  <p>This works fine. But I would like to convert it to Cakephp 3 way as below.</p>
  
  <pre><code>$query = $this
      -&gt;find()
      -&gt;where([
          DATE($this-&gt;aliasField('PUBLISHED_DATE')) =&gt; $userSelectedDate
      ])
  ;
  </code></pre>
  
  <p>This obviously throws an error as below.</p>
  
  <blockquote>
    <p>Error: [PDOException] SQLSTATE[42S22]: Column not found: 1054 Unknown column</p>
  </blockquote>
  
  <p>How to use mysql DATE function in Cakephp 3 query?  I've checked other related answers and I couldn't find a way.</p>