+ Start a Discussion
krishnagkrishnag 

querying the last week data

how to give a query to fetch the data for 2 weeks back from now.

 

i gave like     Date__c = Last_Week - 1  But its showing unidentified identifier ' - ' as an error

Best Answer chosen by Admin (Salesforce Developers) 
Jeremy_nJeremy_n

In Apex, the query criteria would be 

"...where Date__c >= :system.today().addDays(-14) and Date__c <= :system.today()..."

 

Jeremy

All Answers

Jeremy_nJeremy_n

In Apex, the query criteria would be 

"...where Date__c >= :system.today().addDays(-14) and Date__c <= :system.today()..."

 

Jeremy

This was selected as the best answer
krishnagkrishnag

thanks jeremy it worked.