string - Scan DynamoDB table for results from the current month using PHP -


i have table in aws dynamodb, , every item in table has string-type "date" attribute, contains date when specific item created. date in attribute being saved in format: dd/mm/yyyy.

what want scan table, , of results current month. want 2 more individual scans. 1 results last month (for example, july, want results june), , 2 months ago (for example, want results may).

in dynamodb php sdk documentation, demonstrating scan, , in example filtering scan according attribute called "time" using code:

'time' => array(     'attributevaluelist' => array(         array('n' => strtotime('-15 minutes'))     ),     'comparisonoperator' => 'gt' ) 

so thought replace -15 minutes -1 month, problem that, can see in code above, "time" attribute number-type, , not string-type, can't perform action.

what can results current month?

if store data in yyyy/mm/dd format can use begin_with function filter data:

begins_with ( sortkeyname, :sortkeyval ) - true if sort key value begins particular operand. (you cannot use function sort key of type number.) note function name begins_with case-sensitive.

otherwise don't see how possible on data of format.

another option convert unix timestamps , can use <,<=,>,>= or between operators


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -