title: Laravel query Builder with DATE mysql function
body: <p>Hi I have a query in my laravel project which should retrieve dates between ranges. My query is:</p>
  
  <pre><code> $dateFrom = date("Y-m-d", strtotime($request-&gt;dateFrom));
        $dateTo = date("Y-m-d", strtotime($request-&gt;dateTo));
        $posts = DB::table('posts')-&gt;join('categories','posts.category_id','=','categories.id')-&gt;
                  join('users','posts.user_id','=','users.id')
                  -&gt;select('posts.id','posts.topic','categories.category_name','posts.created_at','users.name')
                  -&gt;whereBetween('posts.created_at',[$dateFrom,$dateTo])
                  -&gt;get();
  </code></pre>
  
  <p>I'd like to use DATE mysql_function on column <code>posts.created_at</code> but I don't know how could I do it. Below query dosen't work:</p>
  
  <pre><code>$dateFrom = date("Y-m-d", strtotime($request-&gt;dateFrom));
        $dateTo = date("Y-m-d", strtotime($request-&gt;dateTo));
         $posts = DB::table('posts')-&gt;join('categories','posts.category_id','=','categories.id')-&gt;
                  join('users','posts.user_id','=','users.id')
                  -&gt;select('posts.id','posts.topic','categories.category_name','posts.created_at','users.name')
                  -&gt;whereBetween('DATE(posts.created_at)',[$dateFrom,$dateTo])
                  -&gt;get();
  </code></pre>
  
  <p>I would be greatful for help. Best regards ;)</p>