title: How can I convert a datetime string to a UNIX timestamp in SQLite3?
body: <p><a href="https://www.sqlite.org/datatype3.html">The documentation for SQLite3 datatypes</a> says</p>
  
  <blockquote>
    <p>the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values</p>
  </blockquote>
  
  <p>I want to use those functions to store <code>INTEGER</code> values. How do I do so? <a href="https://www.sqlite.org/lang_datefunc.html">The documentation for SQLite3 datetime functions</a> describes the types of the arguments to those functions, but says nothing of the return type. It seems that the return type is <code>text</code>:</p>
  
  <pre><code>sqlite&gt; select typeOf(datetime('2014-12-12 12:12:12.000'));
  text
  </code></pre>
  
  <p>This is not what I want -- I want an integer value representing that time as a UNIX timestamp. Even when I create a column of type <code>integer</code> and attempt to store a <code>datetime(...)</code> value in it, SQLite stores it as a <code>text</code> value in that <code>integer</code> column.</p>
  
  <p>How do I force the <code>datetime</code> function and friends to return a UNIX timestamp, instead of a <code>text</code> value?</p>