title: formatting datetime objects as strings for SQL
body: <p>I am trying to unit test a new api endpoint I have built which queries a SQLite instance and returns the results. </p>
  
  <p>I am seeding the SQLite instance from JSON, and this is the record I am trying to pick up:</p>
  
  <pre><code>{
      "model": "JobResponse",
      "data": {
          "id": 4,
          "JobId": "1",
          "createdAt": "2017-08-13 00:01"
      }
  },
  </code></pre>
  
  <p>I usually use sequelize, and would use a momentjs object as a timeparam, but the query I need isn't possible in sequelize, so I am using a raw query. My js is generating the following query:</p>
  
  <pre><code>SELECT JobId, WHERE JobId = 2 AND createdAt &gt; 2017-08-13 AND createdAt &lt; 2017-08-14;
  </code></pre>
  
  <p>I am sure this is an issue with the formatting of the datetime element, but both the JSON seed and the SQL query have to be in string form, I have tried <code>moment().format()</code>, but then I get errors e.g:</p>
  
  <blockquote>
    <p>SQLITE_ERROR: near "00"</p>
  </blockquote>
  
  <p>which is presumably because the moment format has spaces in it. </p>
  
  <p>How should I be formatting these datetime parameters as strings?</p>
  
  <h1>Update</h1>
  
  <p>As per the discussion in comments, I have now midified my query to contain inverted commas, e.g. <code>SELECT JobId, FROM JobResponses WHERE createdAt &gt; '2017-08-10 00:00:01' AND createdAt &lt; '2017-08-10 23:59:00' GROUP BY JobId;</code></p>
  
  <p>but I am still not getting any results returned</p>