I have a table in AWS DynamoDB, and every item in this table has a String-type "date" attribute, which contains the date when the specific item was created. The date in this attribute is being saved in this format: dd/mm/YYYY
.
What I want to do is to scan this table, and get all of the results from the current month. I also want to do 2 more individual scans. One for results from the last month (for example, now it is July, so I want to get results from June), and from 2 months ago (for example, I want to get all the results from May).
In the DynamoDB PHP SDK documentation, they are demonstrating a scan, and in the example they are filtering the scan according to an attribute called "time" using this code:
'time' => array(
'AttributeValueList' => array(
array('N' => strtotime('-15 minutes'))
),
'ComparisonOperator' => 'GT'
)
So I thought that I could replace -15 minutes
with -1 month
, but the problem with it is that, as you can see in the code above, the "time" attribute is a Number-type, and not String-type, so I can't perform this action.
What can I do to get results only from the current month?