title: Cassandra - How can I compare timestamp?
body: <p>I have this table:</p>
  
  <pre><code>CREATE TABLE mytablename (
    name text,
    typeid int,
    activefrom timestamp,
    status text,
    PRIMARY KEY ((name), typeid, activefrom)
  )
  </code></pre>
  
  <p>I would like to query a range of timestamp activefrom, for example here some queries:</p>
  
  <ul>
  <li>activefrom > '2000-01-02'</li>
  <li>activefrom > '2000-01-02' AND activefrom &lt; '2010-01-02'</li>
  </ul>
  
  <p>I noticed that it doesn't work as in sql.</p>
  
  <p>For example</p>
  
  <pre><code> name | typeid | activefrom               | status
   ------+--------+--------------------------+--------------
    dani |  99999 | 1970-01-26 00:00:00+0000 | OK
    dani |  99999 | 1970-01-26 01:00:00+0000 | OK
    dani |  99999 | 2070-01-26 00:00:00+0000 | OK
    dani |  99999 | 1970-01-01 00:00:00+0000 | OK
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code>  select * from mytablename where name='dani' and typeid=99999 and activefrom &gt; '2070-01-02 12:51:58+0000';
  </code></pre>
  
  <p>I have as result this:</p>
  
  <pre><code>  dani |  99999 | 2070-01-26 00:00:00+0000 | OK
    dani |  99999 | 1970-01-01 00:00:00+0000 | OK
  </code></pre>
  
  <p>Cassandra version: </p>
  
  <pre><code>  cqlsh 4.1.1 | Cassandra 2.1.13.1218 | CQL spec 3.1.1 | Thrift protocol 19.39.0
  </code></pre>
  
  <p>Any suggestions?
  Thank you</p>