I am getting the error:
DEBUG|Query : Select Id from TestObj__c where CreatedDate <= 2016-07-29 00:00:00 |EXCEPTION_THROWN|[33]|System.QueryException: unexpected token: < |FATAL_ERROR|System.QueryException: unexpected token: <
Decimal noOfDays;
CS_Custom_Settings__c cs = CS_Custom_Settings__c.getOrgDefaults();
if(cs != null && cs.Number_of_days_Purge_Batch_Job__c != null){
noOfDays = cs.Number_of_days_Purge_Batch_Job__c;
}
Date reqDate = Date.today() - Integer.valueOf(noOfDays);
System.debug('*reqDate*'+reqDate);
for(Purge_Batch_Job__c batchJob : Purge_Batch_Job__c.getAll().values()){
objAPINames.add(batchJob.Object_API_Name__c);
}
for(String objName : objAPINames){
//System.debug('Query : ' + 'Select Id from ' + objName + ' where CreatedDate <= ' + reqDate);
System.debug('Query : ' + 'Select Id from ' + objName + ' where CreatedDate <=: reqDate');
for(sObject s : Database.Query('Select Id from ' + objName + ' where CreatedDate <=: reqDate')){
recordIds.add((Id)s.Id);
Please help me out with this