title: How to query a date field for a specific month with Postges and Knex.js
body: <p>Im setting up a new date query using Knex.js and Postgres. I need to return all the rows for a specific month from the table.</p>
  
  <p>This is for a simple app API. Ive managed to return all the fields from the table that I want but don't know how to query the date field for the specific month. Im using Knex.js as my query builder and have the following:</p>
  
  <pre><code>db('table').select() 
  .where('Month(date)', '=', 0  ); //this field where I am lost, 
  </code></pre>
  
  <p>the sql I think will do the job is: <code>EXTRACT(MONTH FROM dateColumn::date) = 1</code>  </p>
  
  <p>I get an error at the moment. But I am expecting to query to return all the date fields that are in the month of January. I know that I could use the <code>.whereRaw()</code> field but Im not 100% sure how to use this either as the documentation does not provide any use cases for date fields.</p>
  
  <p>For reference the column <code>date</code> that I want to query is of format <code>date</code></p>