salesforce - filter by last 13 months -


i have controller using standardsetcontroller implement pagination. want filter trade date last 13 months. date literals don't have filter last_n_months:n

is there way can filter last 13 months?

here current query:

setctrl = new apexpages.standardsetcontroller(database.getquerylocator([select transactiontype__c, tradedate__c, shareclass__c,  settlementdate__c, name, fund__r.name, fund__r.id, firsttransaction__c, dcposition__c, dbr__r.name, dbr__r.id, dbr__c,  amount__c transaction__c dbrprimarycontact__r.contact__c =: con.id order tradedate__c asc])); 

if can't filter 13 months, total number of records can returned in query? 2000? there can significant number of records object , want limit results 13 months of data. once have result set, want add filtering options.

thanks help.

try code below filtering date range - can programatically calculate exact date ranges

 date d1 = date.today();  date d2 = d1.addmonths(-13);  integer d3 = d2.daysbetween(d1);  system.debug('*************' + [select id account createddate >= :d2 ,   createddate <=:d1]); 

Comments