function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.