title: DynamoDB ScanFIlter with BETWEEN comparator
body: <p>I have a requirement whereby I need to scan a DynamoDB table using a filter that allows me to filter documents on the table based on a Date field. Specifically, the filter needs to return the documents whose lastAccessTime (not a hash or range key) field is between the current scan and the last scan. The field is defined, on DynamoDB, as a string and in my Java code I build the condition in the following way:</p>
  
  <pre><code>Condition betweenDateCondition = new Condition()
  .withComparisonOperator(ComparisonOperator.BETWEEN.toString())
  .withAttributeValueList(
      new AttributeValue().withS(dateFormatter.print(getLastScanTime())),
      new AttributeValue().withS(dateFormatter.print(getCurrentScanTime())));
  
  Map&lt;String, Condition&gt; conditions = new HashMap&lt;String, Condition&gt;();
      keyConditions.put("lastAccessTime", betweenDateCondition);
  
  ScanRequest scanRequest = new ScanRequest()
      .withTableName("myTable")
      .withScanFilter(conditions)
      .withLimit(itemLimit)   
      .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL)
      .withExclusiveStartKey(exclusiveStartKey)
      .withTotalSegments(totalSegments)
      .withSegment(segment);
  
  ScanResult scanResult = ddbClient.scan(scanRequest);
  </code></pre>
  
  <p>When I execute this, however, I notice that the filter does not seem to work in that scan operations a few hours apart return the same data. Obviously, data on the DynamoDB table is added only, so I'd expect to receive only the new additions.</p>
  
  <p>Documentation does really spend an incredible amount of words on the use of comparison operators, especially ComparisonOperator.BETWEEN and string dates, and I haven't found similar problems around.</p>