title: PDO: Different results with SQLite BETWEEN
body: <p>I have a SQLite table with dates in unix timestamp format, which I query via PHP <code>PDO</code>. I'd like to mark the rows according to a date range, in my case whether the date falls in the winter semester or the summer semester of the year.</p>
  
  <p>The start and end dates are arbitrary, but in my case I picked
  <code>start</code> as March 1st (0301) and <code>end</code> as September 14th (0914), so I could easily check with <code>BETWEEN</code>.</p>
  
  <p>When I run this query in PHP, like so, it returns an incorrect result (<code>"WS"</code> for all rows):</p>
  
  <pre><code>$statement = $db-&gt;prepare('SELECT CASE WHEN 
      (CAST(strftime("%m%d", class_date, "unixepoch") AS DECIMAL) 
      BETWEEN :start AND :end) 
      THEN "SS" 
      ELSE "WS" END 
      AS semester FROM dates');
  
  $statement-&gt;execute(array(
      ':start' =&gt; 301,
      ':end' =&gt; 915
  ));
  </code></pre>
  
  <p>But when I embed the start and end dates as numbers, instead of binding them, it works correctly (some rows <code>"WS"</code>, some <code>"SS"</code>):</p>
  
  <pre><code>$statement = $db-&gt;prepare('SELECT CASE WHEN 
      (CAST(strftime("%m%d", class_date, "unixepoch") AS DECIMAL) 
      BETWEEN 301 AND 915) 
      THEN "SS"
      ELSE "WS" END 
      AS semester FROM dates');
  $statement-&gt;execute();
  </code></pre>
  
  <p>What is happening here and how can I fix it? Any help is appreciated.</p>