title: DynamoDB query/sort based on timestamp
body: <p>In DynamoDB, I have a table where each record has two date attributes, <code>create_date</code> and <code>last_modified_date</code>. These dates are in ISO-8601 format e.g. <code>2016-01-22T16:19:52.464Z</code>.</p>
  <p>I need to have a way of querying them based on the <code>create_date</code> and <code>last_modified_date</code> e.g.</p>
  <ul>
  <li>get all records where <code>create_date &gt; [some_date]</code></li>
  <li>get all records where <code>last_modified_date &lt; [some_date]</code></li>
  </ul>
  <p>In general, I need to get all records where <code>[date_attr] [comparison_op] [some_date]</code>.</p>
  <p>One way of doing it is to insert a dummy fixed attribute with each record and create an index with the dummy attribute as the partition key and the <code>create_date</code> as the sort key (likewise for <code>last_modified_date</code>.)</p>
  <p>Then I'll be able to query it as such by providing the fixed dummy attribute as partition key, the date attributes as the sort key and use any comparison operators <code>&lt;</code>, <code>&gt;</code>, <code>&lt;=</code>, <code>&gt;=</code>, and so on.</p>
  <p>But this doesn't seem good and looks like a hack instead of a proper solution/design. Are there any better solutions?</p>