So the trick is in getting the date/time in a ‘timestamp’ format and then doing the math and finally converting that back to a date/time. PHP has functions to help do this:
// first let's get today's date '$now'
$now=date('Y-m-d H:i:s', time());
// next create an object for the date
// next let's get the timestamp which expresses time in seconds since jan, 1st 1970 (epoch time)
// now to subtract 30 days measured in seconds
$thirtyDaysAgo=30 * 24 * 60 * 60;
// finally, let's convert it back to a date format we can submit the query for with the > operator added
$qDate='~>~'.date('Y-m-d H:i:s', $then);
// lastly, do the query
$returnArray=$myAppObject.dsQuery('Contact', 1000, 0, array('DateCreated'=>$qDate), $returnFieldsArray);
While each part’s details may vary for your use, the process as I’ve laid it out here is how to determine a specific date range query. You can replace the 30 day math with 60 days or whatever suits your needs.